Fix unreserving through a green PBS signal not setting the state to red.

This also had the side effect of failed reservation attempts through
a reserve-through signal leaving the signal erroneously set to green.
This commit is contained in:
Jonathan G Rennison
2016-03-01 20:52:54 +00:00
parent 83369d5e71
commit 1bb3024534
4 changed files with 17 additions and 2 deletions

View File

@@ -154,6 +154,20 @@ bool TryReserveRailTrack(TileIndex tile, Track t, bool trigger_stations)
return false;
}
/**
* Lift the reservation of a specific trackdir on a tile
* This also sets PBS signals to red if unreserving through the facing track direction
* @param tile the tile
* @param t the track
*/
void UnreserveRailTrackdir(TileIndex tile, Trackdir td)
{
if (HasPbsSignalOnTrackdir(tile, td)) {
SetSignalStateByTrackdir(tile, td, SIGNAL_STATE_RED);
}
UnreserveRailTrack(tile, TrackdirToTrack(td));
}
/**
* Lift the reservation of a specific track on a tile
* @param tile the tile