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/aircraft_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/aircraft_cmd.cpp')
-rw-r--r-- | src/aircraft_cmd.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 2f4f90daa..92720a335 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -680,13 +680,8 @@ CommandCost CmdRefitAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2) Vehicle *u = v->next; uint mail = IsCargoInClass(new_cid, CC_PASSENGERS) ? avi->mail_capacity : 0; u->cargo_cap = mail; - if (v->cargo_type == new_cid) { - v->cargo_count = min(pass, v->cargo_count); - u->cargo_count = min(mail, u->cargo_count); - } else { - v->cargo_count = 0; - u->cargo_count = 0; - } + v->cargo.Truncate(v->cargo_type == new_cid ? pass : 0); + u->cargo.Truncate(v->cargo_type == new_cid ? mail : 0); v->cargo_type = new_cid; v->cargo_subtype = new_subtype; InvalidateWindow(WC_VEHICLE_DETAILS, v->index); @@ -774,7 +769,7 @@ static void AgeAircraftCargo(Vehicle *v) if (_age_cargo_skip_counter != 0) return; do { - if (v->cargo_days != 0xFF) v->cargo_days++; + v->cargo.AgeCargo(); v = v->next; } while (v != NULL); } @@ -1429,11 +1424,11 @@ static void CrashAirplane(Vehicle *v) InvalidateWindow(WC_VEHICLE_VIEW, v->index); uint amt = 2; - if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) amt += v->cargo_count; + if (IsCargoInClass(v->cargo_type, CC_PASSENGERS)) amt += v->cargo.Count(); SetDParam(0, amt); - v->cargo_count = 0; - v->next->cargo_count = 0; + v->cargo.Truncate(0); + v->next->cargo.Truncate(0); const Station *st = GetStation(v->u.air.targetairport); StringID newsitem; if (st->airport_tile == 0) { @@ -1469,7 +1464,7 @@ static void MaybeCrashAirplane(Vehicle *v) /* Crash the airplane. Remove all goods stored at the station. */ for (CargoID i = 0; i < NUM_CARGO; i++) { st->goods[i].rating = 1; - SB(st->goods[i].waiting_acceptance, 0, 12, 0); + st->goods[i].cargo.Truncate(0); } CrashAirplane(v); |