equal
deleted
inserted
replaced
199 * @param p2 unused |
199 * @param p2 unused |
200 * |
200 * |
201 * @todo When checking for the tile slope, |
201 * @todo When checking for the tile slope, |
202 * distingush between "Flat land required" and "land sloped in wrong direction" |
202 * distingush between "Flat land required" and "land sloped in wrong direction" |
203 */ |
203 */ |
204 int32 CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
204 CommandCost CmdBuildTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
205 { |
205 { |
206 Waypoint *wp; |
206 Waypoint *wp; |
207 Slope tileh; |
207 Slope tileh; |
208 Axis axis; |
208 Axis axis; |
209 |
209 |
270 UpdateWaypointSign(wp); |
270 UpdateWaypointSign(wp); |
271 RedrawWaypointSign(wp); |
271 RedrawWaypointSign(wp); |
272 YapfNotifyTrackLayoutChange(tile, AxisToTrack(axis)); |
272 YapfNotifyTrackLayoutChange(tile, AxisToTrack(axis)); |
273 } |
273 } |
274 |
274 |
275 return _price.build_train_depot; |
275 return CommandCost(_price.build_train_depot); |
276 } |
276 } |
277 |
277 |
278 /** |
278 /** |
279 * Daily loop for waypoints |
279 * Daily loop for waypoints |
280 */ |
280 */ |
293 * @param tile from which to remove waypoint |
293 * @param tile from which to remove waypoint |
294 * @param flags type of operation |
294 * @param flags type of operation |
295 * @param justremove will indicate if it is removed from rail or if rails are removed too |
295 * @param justremove will indicate if it is removed from rail or if rails are removed too |
296 * @return cost of operation or error |
296 * @return cost of operation or error |
297 */ |
297 */ |
298 int32 RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove) |
298 CommandCost RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove) |
299 { |
299 { |
300 Waypoint *wp; |
300 Waypoint *wp; |
301 |
301 |
302 /* Make sure it's a waypoint */ |
302 /* Make sure it's a waypoint */ |
303 if (!IsTileType(tile, MP_RAILWAY) || |
303 if (!IsTileType(tile, MP_RAILWAY) || |
322 SetSignalsOnBothDir(tile, track); |
322 SetSignalsOnBothDir(tile, track); |
323 } |
323 } |
324 YapfNotifyTrackLayoutChange(tile, track); |
324 YapfNotifyTrackLayoutChange(tile, track); |
325 } |
325 } |
326 |
326 |
327 return _price.remove_train_depot; |
327 return CommandCost(_price.remove_train_depot); |
328 } |
328 } |
329 |
329 |
330 /** |
330 /** |
331 * Delete a waypoint |
331 * Delete a waypoint |
332 * @param tile tile where waypoint is to be deleted |
332 * @param tile tile where waypoint is to be deleted |
333 * @param flags type of operation |
333 * @param flags type of operation |
334 * @param p1 unused |
334 * @param p1 unused |
335 * @param p2 unused |
335 * @param p2 unused |
336 * @return cost of operation or error |
336 * @return cost of operation or error |
337 */ |
337 */ |
338 int32 CmdRemoveTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
338 CommandCost CmdRemoveTrainWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
339 { |
339 { |
340 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
340 SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION); |
341 return RemoveTrainWaypoint(tile, flags, true); |
341 return RemoveTrainWaypoint(tile, flags, true); |
342 } |
342 } |
343 |
343 |
347 * @param flags type of operation |
347 * @param flags type of operation |
348 * @param p1 id of waypoint |
348 * @param p1 id of waypoint |
349 * @param p2 unused |
349 * @param p2 unused |
350 * @return cost of operation or error |
350 * @return cost of operation or error |
351 */ |
351 */ |
352 int32 CmdRenameWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
352 CommandCost CmdRenameWaypoint(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) |
353 { |
353 { |
354 Waypoint *wp; |
354 Waypoint *wp; |
355 |
355 |
356 if (!IsValidWaypointID(p1)) return CMD_ERROR; |
356 if (!IsValidWaypointID(p1)) return CMD_ERROR; |
357 |
357 |
380 MakeDefaultWaypointName(wp); |
380 MakeDefaultWaypointName(wp); |
381 UpdateWaypointSign(wp); |
381 UpdateWaypointSign(wp); |
382 MarkWholeScreenDirty(); |
382 MarkWholeScreenDirty(); |
383 } |
383 } |
384 } |
384 } |
385 return 0; |
385 return CommandCost(); |
386 } |
386 } |
387 |
387 |
388 /** |
388 /** |
389 * This hacks together some dummy one-shot Station structure for a waypoint. |
389 * This hacks together some dummy one-shot Station structure for a waypoint. |
390 * @param tile on which to work |
390 * @param tile on which to work |