diff options
author | rubidium <rubidium@openttd.org> | 2009-07-29 22:09:05 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-07-29 22:09:05 +0000 |
commit | 959a5e690bb1ca14c4bbc9cc60cdf27700f261f5 (patch) | |
tree | 43c770435e83126ab39539cdd2fc3cca129d2df2 /src/waypoint_cmd.cpp | |
parent | e6480d823a456cc239cd93a16a4020cc8b9895c5 (diff) | |
download | openttd-959a5e690bb1ca14c4bbc9cc60cdf27700f261f5.tar.xz |
(svn r16988) -Codechange: unify the code for removing (parts of) stations and waypoints
Diffstat (limited to 'src/waypoint_cmd.cpp')
-rw-r--r-- | src/waypoint_cmd.cpp | 38 |
1 files changed, 9 insertions, 29 deletions
diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp index bb18b9c14..51db1a7ef 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -197,6 +197,9 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1 wp->facilities |= FACIL_TRAIN; wp->build_date = _date; wp->string_id = STR_SV_STNAME_WAYPOINT; + wp->train_station.tile = tile; + wp->train_station.w = 1; + wp->train_station.h = 1; if (wp->town == NULL) MakeDefaultWaypointName(wp); @@ -215,7 +218,7 @@ CommandCost CmdBuildTrainWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1 * @pre IsRailWaypointTile(tile) * @return cost of operation or error */ -CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justremove) +CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags) { /* Make sure it's a waypoint */ if (!IsRailWaypointTile(tile) || @@ -233,20 +236,12 @@ CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justre Train *v = NULL; uint specindex = GetCustomStationSpecIndex(tile); - if (justremove) { - TrackBits tracks = GetRailStationTrackBits(tile); - bool reserved = HasStationReservation(tile); - MakeRailNormal(tile, wp->owner, tracks, GetRailType(tile)); - if (reserved) SetTrackReservation(tile, tracks); - MarkTileDirtyByTile(tile); - } else { - if (HasStationReservation(tile)) { - v = GetTrainForReservation(tile, track); - if (v != NULL) FreeTrainTrackReservation(v); - } - DoClearSquare(tile); - AddTrackToSignalBuffer(tile, track, wp->owner); + if (HasStationReservation(tile)) { + v = GetTrainForReservation(tile, track); + if (v != NULL) FreeTrainTrackReservation(v); } + DoClearSquare(tile); + AddTrackToSignalBuffer(tile, track, wp->owner); YapfNotifyTrackLayoutChange(tile, track); if (v != NULL) TryPathReserve(v, true); @@ -257,21 +252,6 @@ CommandCost RemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, bool justre return CommandCost(EXPENSES_CONSTRUCTION, _price.remove_train_depot); } -/** - * Delete a waypoint - * @param tile tile where waypoint is to be deleted - * @param flags type of operation - * @param p1 unused - * @param p2 unused - * @param text unused - * @return cost of operation or error - */ -CommandCost CmdRemoveTrainWaypoint(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) -{ - return RemoveTrainWaypoint(tile, flags, true); -} - - /** Build a buoy. * @param tile tile where to place the bouy * @param flags operation to perform |