diff options
author | rubidium <rubidium@openttd.org> | 2007-06-22 11:58:59 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-06-22 11:58:59 +0000 |
commit | e5c352818d7edfdc5219e4c82f7d5b2083b2b72d (patch) | |
tree | fd6fbc96b8d23bef18ed7267fa8174e1689c8e78 /src/roadveh_cmd.cpp | |
parent | 6159f58948763ed39a457e6ff825a735eea06b23 (diff) | |
download | openttd-e5c352818d7edfdc5219e4c82f7d5b2083b2b72d.tar.xz |
(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.
Diffstat (limited to 'src/roadveh_cmd.cpp')
-rw-r--r-- | src/roadveh_cmd.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index e0757429e..0ed011ce7 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -97,7 +97,7 @@ int GetRoadVehImage(const Vehicle* v, Direction direction) } 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 @@ static void RoadVehCrash(Vehicle *v) 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 RoadVehController(Vehicle *v) 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 @@ CommandCost CmdRefitRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) 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); |