Allow removing reservation boundary signal in realistic braking

All other operations were permitted so only disallowing removal
was not useful and could be trivially bypassed
This commit is contained in:
Jonathan G Rennison
2024-05-26 12:13:49 +01:00
parent 431a6a1262
commit effaf6acc4

View File

@@ -2276,18 +2276,6 @@ CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32_t
Train *v = nullptr;
if (HasReservedTracks(tile, TrackToTrackBits(track))) {
v = GetTrainForReservation(tile, track);
} else if (IsPbsSignal(GetSignalType(tile, track))) {
/* PBS signal, might be the end of a path reservation. */
Trackdir td = TrackToTrackdir(track);
for (int i = 0; v == nullptr && i < 2; i++, td = ReverseTrackdir(td)) {
/* Only test the active signal side. */
if (!HasSignalOnTrackdir(tile, ReverseTrackdir(td))) continue;
TileIndex next = TileAddByDiagDir(tile, TrackdirToExitdir(td));
TrackBits tracks = TrackdirBitsToTrackBits(TrackdirReachesTrackdirs(td));
if (HasReservedTracks(next, tracks)) {
v = GetTrainForReservation(next, TrackBitsToTrack(GetReservedTrackbits(next) & tracks));
}
}
}
if (v != nullptr) {
CommandCost ret = CheckTrainReservationPreventsTrackModification(v);