src/signs.cpp
branchNewGRF_ports
changeset 6720 35756db7e577
parent 6719 4cc327ad39d5
child 6725 23339968083f
equal deleted inserted replaced
6719:4cc327ad39d5 6720:35756db7e577
    37  *
    37  *
    38  */
    38  */
    39 static void UpdateSignVirtCoords(Sign *si)
    39 static void UpdateSignVirtCoords(Sign *si)
    40 {
    40 {
    41 	Point pt = RemapCoords(si->x, si->y, si->z);
    41 	Point pt = RemapCoords(si->x, si->y, si->z);
    42 	SetDParam(0, si->str);
    42 	SetDParam(0, si->index);
    43 	UpdateViewportSignPos(&si->sign, pt.x, pt.y - 6, STR_2806);
    43 	UpdateViewportSignPos(&si->sign, pt.x, pt.y - 6, STR_2806);
    44 }
    44 }
    45 
    45 
    46 /**
    46 /**
    47  *
    47  *
   120  * @param tile tile to place sign at
   120  * @param tile tile to place sign at
   121  * @param flags type of operation
   121  * @param flags type of operation
   122  * @param p1 unused
   122  * @param p1 unused
   123  * @param p2 unused
   123  * @param p2 unused
   124  */
   124  */
   125 int32 CmdPlaceSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
   125 CommandCost CmdPlaceSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
   126 {
   126 {
   127 	Sign *si;
   127 	Sign *si;
   128 
   128 
   129 	/* Try to locate a new sign */
   129 	/* Try to locate a new sign */
   130 	si = AllocateSign();
   130 	si = AllocateSign();
   145 		InvalidateWindow(WC_SIGN_LIST, 0);
   145 		InvalidateWindow(WC_SIGN_LIST, 0);
   146 		_sign_sort_dirty = true;
   146 		_sign_sort_dirty = true;
   147 		_new_sign = si;
   147 		_new_sign = si;
   148 	}
   148 	}
   149 
   149 
   150 	return 0;
   150 	return CommandCost();
   151 }
   151 }
   152 
   152 
   153 /** Rename a sign. If the new name of the sign is empty, we assume
   153 /** Rename a sign. If the new name of the sign is empty, we assume
   154  * the user wanted to delete it. So delete it. Ownership of signs
   154  * the user wanted to delete it. So delete it. Ownership of signs
   155  * has no meaning/effect whatsoever except for eyecandy
   155  * has no meaning/effect whatsoever except for eyecandy
   157  * @param flags type of operation
   157  * @param flags type of operation
   158  * @param p1 index of the sign to be renamed/removed
   158  * @param p1 index of the sign to be renamed/removed
   159  * @param p2 unused
   159  * @param p2 unused
   160  * @return 0 if succesfull, otherwise CMD_ERROR
   160  * @return 0 if succesfull, otherwise CMD_ERROR
   161  */
   161  */
   162 int32 CmdRenameSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
   162 CommandCost CmdRenameSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
   163 {
   163 {
   164 	if (!IsValidSignID(p1)) return CMD_ERROR;
   164 	if (!IsValidSignID(p1)) return CMD_ERROR;
   165 
   165 
   166 	/* If _cmd_text 0 means the new text for the sign is non-empty.
   166 	/* If _cmd_text 0 means the new text for the sign is non-empty.
   167 	 * So rename the sign. If it is empty, it has no name, so delete it */
   167 	 * So rename the sign. If it is empty, it has no name, so delete it */
   199 			InvalidateWindow(WC_SIGN_LIST, 0);
   199 			InvalidateWindow(WC_SIGN_LIST, 0);
   200 			_sign_sort_dirty = true;
   200 			_sign_sort_dirty = true;
   201 		}
   201 		}
   202 	}
   202 	}
   203 
   203 
   204 	return 0;
   204 	return CommandCost();
   205 }
   205 }
   206 
   206 
   207 /**
   207 /**
   208  * Callback function that is called after a sign is placed
   208  * Callback function that is called after a sign is placed
   209  * @param success of the operation
   209  * @param success of the operation