diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/train_cmd.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index b0cb85ff4..4505c6abd 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -3150,6 +3150,15 @@ bool TryPathReserve(Train *v, bool mark_as_stuck, bool first_tile_okay) bool other_train = false; PBSTileInfo origin = FollowTrainReservation(v, &other_train); + /* The path we are driving on is alread blocked by some other train. + * This can only happen in certain situations when mixing path and + * block signals or when changing tracks and/or signals. + * Exit here as doing any further reservations will probably just + * make matters worse. */ + if (other_train && v->tile != origin.tile) { + if (mark_as_stuck) MarkTrainAsStuck(v); + return false; + } /* If we have a reserved path and the path ends at a safe tile, we are finished already. */ if (origin.okay && (v->tile != origin.tile || first_tile_okay)) { /* Can't be stuck then. */ @@ -3157,14 +3166,6 @@ bool TryPathReserve(Train *v, bool mark_as_stuck, bool first_tile_okay) ClrBit(v->flags, VRF_TRAIN_STUCK); return true; } - /* The path we are driving on is alread blocked by some other train. - * This can only happen when tracks and signals are changed. A crash - * is probably imminent, don't do any further reservation because - * it might cause stale reservations. */ - if (other_train && v->tile != origin.tile) { - if (mark_as_stuck) MarkTrainAsStuck(v); - return false; - } /* If we are in a depot, tentativly reserve the depot. */ if (v->track == TRACK_BIT_DEPOT) { |