mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-04 06:00:15 +00:00
(svn r17152) -Fix: A stuck train could free the reservation of another train if it was reversed or did crash.
This commit is contained in:
parent
da18471d48
commit
b84e93487f
@ -1910,8 +1910,8 @@ static void ReverseTrainDirection(Train *v)
|
||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||
}
|
||||
|
||||
/* Clear path reservation in front. */
|
||||
FreeTrainTrackReservation(v);
|
||||
/* Clear path reservation in front if train is not stuck. */
|
||||
if (!HasBit(v->flags, VRF_TRAIN_STUCK)) FreeTrainTrackReservation(v);
|
||||
|
||||
/* Check if we were approaching a rail/road-crossing */
|
||||
TileIndex crossing = TrainApproachingCrossingTile(v);
|
||||
@ -3510,11 +3510,10 @@ static void SetVehicleCrashed(Train *v)
|
||||
{
|
||||
if (v->crash_anim_pos != 0) return;
|
||||
|
||||
/* Free a possible path reservation and try to mark all tiles occupied by the train reserved. */
|
||||
if (v->IsFrontEngine()) {
|
||||
/* Remove all reservations, also the ones currently under the train
|
||||
* and any railway station paltform reservation. */
|
||||
FreeTrainTrackReservation(v);
|
||||
/* Remove the reserved path in front of the train if it is not stuck.
|
||||
* Also clear all reserved tracks the train is currently on. */
|
||||
if (!HasBit(v->flags, VRF_TRAIN_STUCK)) FreeTrainTrackReservation(v);
|
||||
for (const Train *u = v; u != NULL; u = u->Next()) {
|
||||
ClearPathReservation(u, u->tile, u->GetVehicleTrackdir());
|
||||
if (IsTileType(u->tile, MP_TUNNELBRIDGE)) {
|
||||
|
@ -805,7 +805,7 @@ static void FloodVehicle(Vehicle *v)
|
||||
/* FreeTrainTrackReservation() calls GetVehicleTrackdir() that doesn't like crashed vehicles.
|
||||
* In this case, v->direction matches v->u.rail.track, so we can do this (it wasn't crashed before) */
|
||||
t->vehstatus &= ~VS_CRASHED;
|
||||
FreeTrainTrackReservation(t);
|
||||
if (!HasBit(t->flags, VRF_TRAIN_STUCK)) FreeTrainTrackReservation(t);
|
||||
t->vehstatus |= VS_CRASHED;
|
||||
}
|
||||
t->crash_anim_pos = 4000; // max 4440, disappear pretty fast
|
||||
|
Loading…
Reference in New Issue
Block a user