Changeset - r8902:ec9b5ae2baa1
[Not reviewed]
master
0 1 0
rubidium - 16 years ago 2008-04-12 12:51:16
rubidium@openttd.org
(svn r12669) -Fix (r12667): crash when a vehicle has never been to a station and the load percentage conditional variable is evaluated.
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/vehicle.cpp
Show inline comments
 
@@ -2150,13 +2150,13 @@ uint8 CalcPercentVehicleFilled(Vehicle *
 
	bool loading = false;
 

	
 
	const Vehicle *u = v;
 
	const Station *st = GetStation(v->last_station_visited);
 
	const Station *st = v->last_station_visited != INVALID_STATION ? GetStation(v->last_station_visited) : NULL;
 

	
 
	/* Count up max and used */
 
	for (; v != NULL; v = v->Next()) {
 
		count += v->cargo.Count();
 
		max += v->cargo_cap;
 
		if (v->cargo_cap != 0) {
 
		if (v->cargo_cap != 0 && color != NULL) {
 
			unloading += HasBit(v->vehicle_flags, VF_CARGO_UNLOADING) ? 1 : 0;
 
			loading |= !(u->current_order.GetUnloadType() & OUFB_UNLOAD) && st->goods[v->cargo_type].days_since_pickup != 255;
 
			cars++;
0 comments (0 inline, 0 general)