equal
deleted
inserted
replaced
38 * |
38 * |
39 */ |
39 */ |
40 static void UpdateSignVirtCoords(Sign *si) |
40 static void UpdateSignVirtCoords(Sign *si) |
41 { |
41 { |
42 Point pt = RemapCoords(si->x, si->y, si->z); |
42 Point pt = RemapCoords(si->x, si->y, si->z); |
43 SetDParam(0, si->str); |
43 SetDParam(0, si->index); |
44 UpdateViewportSignPos(&si->sign, pt.x, pt.y - 6, STR_2806); |
44 UpdateViewportSignPos(&si->sign, pt.x, pt.y - 6, STR_2806); |
45 } |
45 } |
46 |
46 |
47 /** |
47 /** |
48 * |
48 * |
121 * @param tile tile to place sign at |
121 * @param tile tile to place sign at |
122 * @param flags type of operation |
122 * @param flags type of operation |
123 * @param p1 unused |
123 * @param p1 unused |
124 * @param p2 unused |
124 * @param p2 unused |
125 */ |
125 */ |
126 int32 CmdPlaceSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
126 CommandCost CmdPlaceSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
127 { |
127 { |
128 Sign *si; |
128 Sign *si; |
129 |
129 |
130 /* Try to locate a new sign */ |
130 /* Try to locate a new sign */ |
131 si = AllocateSign(); |
131 si = AllocateSign(); |
147 _sign_sort_dirty = true; |
147 _sign_sort_dirty = true; |
148 _new_sign_id = si->index; |
148 _new_sign_id = si->index; |
149 _total_signs++; |
149 _total_signs++; |
150 } |
150 } |
151 |
151 |
152 return 0; |
152 return CommandCost(); |
153 } |
153 } |
154 |
154 |
155 /** Rename a sign. If the new name of the sign is empty, we assume |
155 /** Rename a sign. If the new name of the sign is empty, we assume |
156 * the user wanted to delete it. So delete it. Ownership of signs |
156 * the user wanted to delete it. So delete it. Ownership of signs |
157 * has no meaning/effect whatsoever except for eyecandy |
157 * has no meaning/effect whatsoever except for eyecandy |
159 * @param flags type of operation |
159 * @param flags type of operation |
160 * @param p1 index of the sign to be renamed/removed |
160 * @param p1 index of the sign to be renamed/removed |
161 * @param p2 unused |
161 * @param p2 unused |
162 * @return 0 if succesfull, otherwise CMD_ERROR |
162 * @return 0 if succesfull, otherwise CMD_ERROR |
163 */ |
163 */ |
164 int32 CmdRenameSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
164 CommandCost CmdRenameSign(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
165 { |
165 { |
166 if (!IsValidSignID(p1)) return CMD_ERROR; |
166 if (!IsValidSignID(p1)) return CMD_ERROR; |
167 |
167 |
168 /* If _cmd_text 0 means the new text for the sign is non-empty. |
168 /* If _cmd_text 0 means the new text for the sign is non-empty. |
169 * So rename the sign. If it is empty, it has no name, so delete it */ |
169 * So rename the sign. If it is empty, it has no name, so delete it */ |
202 _sign_sort_dirty = true; |
202 _sign_sort_dirty = true; |
203 _total_signs--; |
203 _total_signs--; |
204 } |
204 } |
205 } |
205 } |
206 |
206 |
207 return 0; |
207 return CommandCost(); |
208 } |
208 } |
209 |
209 |
210 /** |
210 /** |
211 * Callback function that is called after a sign is placed |
211 * Callback function that is called after a sign is placed |
212 * @param success of the operation |
212 * @param success of the operation |