@@ -3059,7 +3059,8 @@ bool TryPathReserve(Vehicle *v, bool mar
}
PBSTileInfo origin = FollowTrainReservation(v);
Vehicle *other_train = NULL;
PBSTileInfo origin = FollowTrainReservation(v, &other_train);
/* 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. */
@@ -3067,6 +3068,14 @@ bool TryPathReserve(Vehicle *v, bool mar
ClrBit(v->u.rail.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 != NULL && v->tile != origin.tile) {
if (mark_as_stuck) MarkTrainAsStuck(v);
return false;
/* If we are in a depot, tentativly reserve the depot. */
if (v->u.rail.track & TRACK_BIT_DEPOT) {