mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r20098) -Fix [FS#3898]: A train reversing in a station would sometimes fail to release its reserved path.
This commit is contained in:
parent
82fc340a0a
commit
811f0db597
|
@ -41,6 +41,9 @@ enum VehicleRailFlags {
|
||||||
|
|
||||||
/* used to mark a train that can't get a path reservation */
|
/* used to mark a train that can't get a path reservation */
|
||||||
VRF_TRAIN_STUCK = 8,
|
VRF_TRAIN_STUCK = 8,
|
||||||
|
|
||||||
|
/* used to mark a train that is just leaving a station */
|
||||||
|
VRF_LEAVING_STATION = 9,
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Modes for ignoring signals. */
|
/** Modes for ignoring signals. */
|
||||||
|
|
|
@ -3808,8 +3808,17 @@ static bool TrainLocoHandler(Train *v, bool mode)
|
||||||
v->wait_counter = 0;
|
v->wait_counter = 0;
|
||||||
v->cur_speed = 0;
|
v->cur_speed = 0;
|
||||||
v->subspeed = 0;
|
v->subspeed = 0;
|
||||||
|
ClrBit(v->flags, VRF_LEAVING_STATION);
|
||||||
ReverseTrainDirection(v);
|
ReverseTrainDirection(v);
|
||||||
return true;
|
return true;
|
||||||
|
} else if (HasBit(v->flags, VRF_LEAVING_STATION)) {
|
||||||
|
/* Try to reserve a path when leaving the station as we
|
||||||
|
* might not be marked as wanting a reservation, e.g.
|
||||||
|
* when an overlength train gets turned around in a station. */
|
||||||
|
if (UpdateSignalsOnSegment(v->tile, TrackdirToExitdir(v->GetVehicleTrackdir()), v->owner) == SIGSEG_PBS || _settings_game.pf.reserve_paths) {
|
||||||
|
TryPathReserve(v, true, true);
|
||||||
|
}
|
||||||
|
ClrBit(v->flags, VRF_LEAVING_STATION);
|
||||||
}
|
}
|
||||||
|
|
||||||
v->HandleLoading(mode);
|
v->HandleLoading(mode);
|
||||||
|
|
|
@ -1635,12 +1635,7 @@ void Vehicle::LeaveStation()
|
||||||
/* Trigger station animation (trains only) */
|
/* Trigger station animation (trains only) */
|
||||||
if (IsTileType(this->tile, MP_STATION)) StationAnimationTrigger(st, this->tile, STAT_ANIM_TRAIN_DEPARTS);
|
if (IsTileType(this->tile, MP_STATION)) StationAnimationTrigger(st, this->tile, STAT_ANIM_TRAIN_DEPARTS);
|
||||||
|
|
||||||
/* Try to reserve a path when leaving the station as we
|
SetBit(Train::From(this)->flags, VRF_LEAVING_STATION);
|
||||||
* might not be marked as wanting a reservation, e.g.
|
|
||||||
* when an overlength train gets turned around in a station. */
|
|
||||||
if (UpdateSignalsOnSegment(this->tile, TrackdirToExitdir(this->GetVehicleTrackdir()), this->owner) == SIGSEG_PBS || _settings_game.pf.reserve_paths) {
|
|
||||||
TryPathReserve(Train::From(this), true, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue