Changeset - r16934:30f3bc1c6966
[Not reviewed]
master
0 1 0
rubidium - 13 years ago 2010-12-31 15:53:46
rubidium@openttd.org
(svn r21679) -Fix (r21642): reading a just freed variable
1 file changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/vehicle.cpp
Show inline comments
 
@@ -1738,27 +1738,28 @@ uint GetVehicleCapacity(const Vehicle *v
 
}
 

	
 

	
 
void Vehicle::BeginLoading()
 
{
 
	assert(IsTileType(tile, MP_STATION) || type == VEH_SHIP);
 

	
 
	if (this->current_order.IsType(OT_GOTO_STATION) &&
 
			this->current_order.GetDestination() == this->last_station_visited) {
 
		current_order.MakeLoading(true);
 
		UpdateVehicleTimetable(this, true);
 

	
 
		for (Order *order = this->GetOrder(this->cur_order_index);
 
				order != NULL && order->IsType(OT_AUTOMATIC);
 
				order = order->next) {
 
		const Order *order = this->GetOrder(this->cur_order_index);
 
		while (order != NULL && order->IsType(OT_AUTOMATIC)) {
 
			/* Delete order effectively deletes order, so get the next before deleting it. */
 
			order = order->next;
 
			DeleteOrder(this, this->cur_order_index);
 
		}
 

	
 
		/* Furthermore add the Non Stop flag to mark that this station
 
		 * is the actual destination of the vehicle, which is (for example)
 
		 * necessary to be known for HandleTrainLoading to determine
 
		 * whether the train is lost or not; not marking a train lost
 
		 * that arrives at random stations is bad. */
 
		this->current_order.SetNonStopType(ONSF_NO_STOP_AT_ANY_STATION);
 

	
 
	} else {
 
		/* We weren't scheduled to stop here. Insert an automatic order
0 comments (0 inline, 0 general)