Changeset - r19756:f17735d75608
[Not reviewed]
master
0 1 0
frosch - 12 years ago 2012-11-12 20:12:26
frosch@openttd.org
(svn r24711) -Fix (r10354): Check whether to not display a ^ loading indicator at drop stations only worked if there was no other vehicle unloading for 255 ticks.
1 file changed with 9 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/vehicle.cpp
Show inline comments
 
@@ -1237,23 +1237,30 @@ uint8 CalcPercentVehicleFilled(const Veh
 
	int count = 0;
 
	int max = 0;
 
	int cars = 0;
 
	int unloading = 0;
 
	bool loading = false;
 

	
 
	bool is_loading = front->current_order.IsType(OT_LOADING);
 

	
 
	/* The station may be NULL when the (colour) string does not need to be set. */
 
	const Station *st = Station::GetIfValid(front->last_station_visited);
 
	assert(colour == NULL || st != NULL);
 
	assert(colour == NULL || (st != NULL && is_loading));
 

	
 
	bool order_no_load = is_loading && (front->current_order.GetLoadType() & OLFB_NO_LOAD);
 
	bool order_full_load = is_loading && (front->current_order.GetLoadType() & OLFB_FULL_LOAD);
 

	
 
	/* Count up max and used */
 
	for (const Vehicle *v = front; v != NULL; v = v->Next()) {
 
		count += v->cargo.Count();
 
		max += v->cargo_cap;
 
		if (v->cargo_cap != 0 && colour != NULL) {
 
			unloading += HasBit(v->vehicle_flags, VF_CARGO_UNLOADING) ? 1 : 0;
 
			loading |= !(front->current_order.GetLoadType() & OLFB_NO_LOAD) && st->goods[v->cargo_type].days_since_pickup != 255;
 
			loading |= !order_no_load &&
 
					(order_full_load || HasBit(st->goods[v->cargo_type].acceptance_pickup, GoodsEntry::GES_PICKUP)) &&
 
					!HasBit(v->vehicle_flags, VF_LOADING_FINISHED) && !HasBit(v->vehicle_flags, VF_STOP_LOADING);
 
			cars++;
 
		}
 
	}
 

	
 
	if (colour != NULL) {
 
		if (unloading == 0 && loading) {
0 comments (0 inline, 0 general)