Check blocking train reservation before removing signals in CmdRemoveSingleRail
This commit is contained in:
@@ -967,12 +967,6 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||
|
||||
cost.AddCost(RailClearCost(GetTileRailTypeByTrackBit(tile, trackbit)));
|
||||
|
||||
/* Charge extra to remove signals on the track, if they are there */
|
||||
if (HasSignalOnTrack(tile, track)) {
|
||||
if (flags & DC_EXEC) CheckRemoveSignal(tile, track);
|
||||
cost.AddCost(DoCommand(tile, track, 0, flags, CMD_REMOVE_SIGNALS));
|
||||
}
|
||||
|
||||
if (HasReservedTracks(tile, trackbit)) {
|
||||
v = GetTrainForReservation(tile, track);
|
||||
if (v != nullptr) {
|
||||
@@ -981,6 +975,11 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1,
|
||||
}
|
||||
}
|
||||
|
||||
/* Charge extra to remove signals on the track, if they are there */
|
||||
if (HasSignalOnTrack(tile, track)) {
|
||||
cost.AddCost(DoCommand(tile, track, 0, flags, CMD_REMOVE_SIGNALS));
|
||||
}
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
if (v != nullptr) FreeTrainTrackReservation(v);
|
||||
|
||||
|
Reference in New Issue
Block a user