diff options
Diffstat (limited to 'src/waypoint.cpp')
-rw-r--r-- | src/waypoint.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/waypoint.cpp b/src/waypoint.cpp index ad86a6690..ac81cc45d 100644 --- a/src/waypoint.cpp +++ b/src/waypoint.cpp @@ -33,6 +33,8 @@ #include "newgrf_station.h" #include "oldpool_func.h" #include "viewport_func.h" +#include "pbs.h" +#include "train.h" #include "table/strings.h" @@ -320,6 +322,7 @@ CommandCost RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove) wp->deleted = 30; // let it live for this many days before we do the actual deletion. RedrawWaypointSign(wp); + Vehicle *v = NULL; if (justremove) { TrackBits tracks = GetRailWaypointBits(tile); bool reserved = GetDepotWaypointReservation(tile); @@ -327,10 +330,15 @@ CommandCost RemoveTrainWaypoint(TileIndex tile, uint32 flags, bool justremove) if (reserved) SetTrackReservation(tile, tracks); MarkTileDirtyByTile(tile); } else { + if (GetDepotWaypointReservation(tile)) { + v = GetTrainForReservation(tile, track); + if (v != NULL) FreeTrainTrackReservation(v); + } DoClearSquare(tile); AddTrackToSignalBuffer(tile, track, owner); } YapfNotifyTrackLayoutChange(tile, track); + if (v != NULL) TryPathReserve(v, true); } return CommandCost(EXPENSES_CONSTRUCTION, _price.remove_train_depot); |