Changeset - r6575:dca9004ed3b0
[Not reviewed]
master
0 1 0
rubidium - 17 years ago 2007-05-05 09:51:26
rubidium@openttd.org
(svn r9789) -Fix (r9770): vehicles didn't get unloaded when 'full load' was specified and the vehicle was already full when it entered.
1 file changed with 3 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/vehicle.cpp
Show inline comments
 
@@ -701,13 +701,12 @@ void CallVehicleTicks()
 
	}
 
}
 

	
 
static bool CanFillVehicle_FullLoadAny(Vehicle *v)
 
{
 
	uint32 full = 0, not_full = 0;
 
	bool keep_loading = false;
 
	const GoodsEntry *ge = GetStation(v->last_station_visited)->goods;
 

	
 
	/* special handling of aircraft */
 

	
 
	/* if the aircraft carries passengers and is NOT full, then
 
	 *continue loading, no matter how much mail is in */
 
@@ -722,27 +721,27 @@ static bool CanFillVehicle_FullLoadAny(V
 
		/* Should never happen, but just in case future additions change this */
 
		assert(v->cargo_type<32);
 

	
 
		if (v->cargo_cap != 0) {
 
			uint32 mask = 1 << v->cargo_type;
 

	
 
			if (v->cargo_cap == v->cargo_count) {
 
			if (!HASBIT(v->vehicle_flags, VF_CARGO_UNLOADING) && v->cargo_cap == v->cargo_count) {
 
				full |= mask;
 
			} else if (GB(ge[v->cargo_type].waiting_acceptance, 0, 12) > 0 ||
 
					(HASBIT(v->vehicle_flags, VF_CARGO_UNLOADING) && (ge[v->cargo_type].waiting_acceptance & 0x8000))) {
 
				/* If there is any cargo waiting, or this vehicle is still unloading
 
				 * and the station accepts the cargo, don't leave the station. */
 
				keep_loading = true;
 
				return true;
 
			} else {
 
				not_full |= mask;
 
			}
 
		}
 
	} while ((v = v->next) != NULL);
 

	
 
	/* continue loading if there is a non full cargo type and no cargo type that is full */
 
	return keep_loading || (not_full && (full & ~not_full) == 0);
 
	return not_full && (full & ~not_full) == 0;
 
}
 

	
 

	
 
bool CanFillVehicle(Vehicle *front_v)
 
{
 
	TileIndex tile = front_v->tile;
0 comments (0 inline, 0 general)