Changeset - r11689:154feeb8fd54
[Not reviewed]
master
0 2 0
rubidium - 15 years ago 2009-04-18 13:43:05
rubidium@openttd.org
(svn r16079) -Fix [FS#2824]: insanely fast trains would not stop in time for stations
-Fix: insanely fast trains would sometimes 'jump' over waypoints/via stations within a tick, which would cause the order not to be processed causing the train to go in loops until (with luck) it 'hit' the tile
2 files changed with 18 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/train_cmd.cpp
Show inline comments
 
@@ -4375,10 +4375,25 @@ static void TrainLocoHandler(Vehicle *v,
 
		do {
 
			j -= adv_spd;
 
			TrainController(v, NULL);
 
			/* Don't continue to move if the train crashed. */
 
			if (CheckTrainCollision(v)) break;
 

	
 
			/* 192 spd used for going straight, 256 for going diagonally. */
 
			adv_spd = (v->direction & 1) ? 192 : 256;
 

	
 
			if (j >= adv_spd) {
 
				/* Don't continue to move if the train crashed or isn't moving. */
 
				if (CheckTrainCollision(v) || v->cur_speed == 0) break;
 

	
 
				OrderType order_type = v->current_order.GetType();
 
				/* Do not skip waypoints (incl. 'via' stations) when passing through at full speed. */
 
				if ((order_type == OT_GOTO_WAYPOINT &&
 
							v->dest_tile == v->tile) ||
 
						(order_type == OT_GOTO_STATION &&
 
							(v->current_order.GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION) &&
 
							IsTileType(v->tile, MP_STATION) &&
 
							v->current_order.GetDestination() == GetStationIndex(v->tile))) {
 
					ProcessOrders(v);
 
				}
 
			}
 
		} while (j >= adv_spd);
 
		SetLastSpeed(v, v->cur_speed);
 
	}
src/vehicle.cpp
Show inline comments
 
@@ -1514,6 +1514,7 @@ void Vehicle::BeginLoading()
 
	InvalidateWindow(WC_STATION_VIEW, this->last_station_visited);
 

	
 
	GetStation(this->last_station_visited)->MarkTilesDirty(true);
 
	this->cur_speed = 0;
 
	this->MarkDirty();
 
}
 

	
0 comments (0 inline, 0 general)