diff src/roadveh_cmd.cpp @ 7010:f0f87c5a431e draft

(svn r10266) -Codechange: keep track of the origin, time of travel and accumulated feeder share (transfers) of individual pieces of cargo. This means that cargo isn't thrown on a big pile when it's put in a station or unloaded at a station, however the GUI does not reflect these changes yet so you will not actually see it.
author rubidium <rubidium@openttd.org>
date Fri, 22 Jun 2007 11:58:59 +0000
parents cb6b3e277df0
children 1997a5b53cec
line wrap: on
line diff
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -97,7 +97,7 @@
 	}
 
 	image = direction + _roadveh_images[img];
-	if (v->cargo_count >= v->cargo_cap / 2) image += _roadveh_full_adder[img];
+	if (v->cargo.Count() >= v->cargo_cap / 2) image += _roadveh_full_adder[img];
 	return image;
 }
 
@@ -677,7 +677,7 @@
 	v->u.road.crashed_ctr++;
 
 	for (Vehicle *u = v; u != NULL; u = u->next) {
-		if (IsCargoInClass(u->cargo_type, CC_PASSENGERS)) pass += u->cargo_count;
+		if (IsCargoInClass(u->cargo_type, CC_PASSENGERS)) pass += u->cargo.Count();
 
 		u->vehstatus |= VS_CRASHED;
 
@@ -1826,7 +1826,7 @@
 static void AgeRoadVehCargo(Vehicle *v)
 {
 	if (_age_cargo_skip_counter != 0) return;
-	if (v->cargo_days != 255) v->cargo_days++;
+	v->cargo.AgeCargo();
 }
 
 void RoadVeh_Tick(Vehicle *v)
@@ -2069,7 +2069,7 @@
 
 	if (flags & DC_EXEC) {
 		v->cargo_cap = capacity;
-		v->cargo_count = (v->cargo_type == new_cid) ? min(capacity, v->cargo_count) : 0;
+		v->cargo.Truncate((v->cargo_type == new_cid) ? capacity : 0);
 		v->cargo_type = new_cid;
 		v->cargo_subtype = new_subtype;
 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);