Changeset - r9891:4db9c2615c78
[Not reviewed]
master
0 2 0
rubidium - 16 years ago 2008-08-10 21:56:47
rubidium@openttd.org
(svn r14039) -Fix [FS#2217]: reversing an overlength train at a station would try to find a route out and sometimes reset the unload counter making it wait 2.5 years before departing instead of waiting until the train would actually leave the station (michi_cc)
2 files changed with 14 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/train_cmd.cpp
Show inline comments
 
@@ -1947,15 +1947,18 @@ static void ReverseTrainDirection(Vehicl
 
		 * current tile as a safe tile or we would enter a PBS block without a reservation. */
 
		bool first_tile_okay = !(IsTileType(v->tile, MP_RAILWAY) &&
 
			HasSignalOnTrackdir(v->tile, GetVehicleTrackdir(v)) &&
 
			!IsPbsSignal(GetSignalType(v->tile, FindFirstTrack(v->u.rail.track))));
 

	
 
		if (IsRailwayStationTile(v->tile)) SetRailwayStationPlatformReservation(v->tile, TrackdirToExitdir(GetVehicleTrackdir(v)), true);
 
		if (TryPathReserve(v, true, first_tile_okay)) {
 
		if (TryPathReserve(v, false, first_tile_okay)) {
 
			/* Do a look-ahead now in case our current tile was already a safe tile. */
 
			CheckNextTrainTile(v);
 
		} else if (v->current_order.GetType() != OT_LOADING) {
 
			/* Do not wait for a way out when we're still loading */
 
			MarkTrainAsStuck(v);
 
		}
 
	}
 
}
 

	
 
/** Reverse train.
 
 * @param tile unused
src/vehicle.cpp
Show inline comments
 
@@ -2342,14 +2342,22 @@ void Vehicle::LeaveStation()
 
	Station *st = GetStation(this->last_station_visited);
 
	st->loading_vehicles.remove(this);
 

	
 
	HideFillingPercent(this->fill_percent_te_id);
 
	this->fill_percent_te_id = INVALID_TE_ID;
 

	
 
	/* Trigger station animation for trains only */
 
	if (this->type == VEH_TRAIN && IsTileType(this->tile, MP_STATION)) StationAnimationTrigger(st, this->tile, STAT_ANIM_TRAIN_DEPARTS);
 
	if (this->type == VEH_TRAIN) {
 
		/* Trigger station animation (trains only) */
 
		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
 
		 * might not be marked as wanting a reservation, e.g.
 
		 * when an overlenght train gets turned around in a station.
 
		 */
 
		TryPathReserve(this, true, true);
 
	}
 
}
 

	
 

	
 
void Vehicle::HandleLoading(bool mode)
 
{
 
	switch (this->current_order.GetType()) {
0 comments (0 inline, 0 general)