diff options
author | celestar <celestar@openttd.org> | 2005-01-07 09:51:16 +0000 |
---|---|---|
committer | celestar <celestar@openttd.org> | 2005-01-07 09:51:16 +0000 |
commit | 9a4465f9c0db69b3d9da903b67b678a0ee3a565e (patch) | |
tree | dd060d5dca61f8a204e1ed8e93a87362d44f4945 /aircraft_cmd.c | |
parent | e58739c55963b22a345e3efb78e7c10d5646b383 (diff) | |
download | openttd-9a4465f9c0db69b3d9da903b67b678a0ee3a565e.tar.xz |
(svn r1412) -Feature/Fix: Aircraft refit options have been restricted to "sane"
values.
-Feature: aircraft can now be refitted "mail-only"
-Feature: Passengers aircraft now ignore the amount of mail for "full
load any" options
Diffstat (limited to 'aircraft_cmd.c')
-rw-r--r-- | aircraft_cmd.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/aircraft_cmd.c b/aircraft_cmd.c index 86b4b0d4b..7d52329d9 100644 --- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -416,18 +416,30 @@ int32 CmdRefitAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2) int32 cost; byte SkipStoppedInHangerCheck = (p2 & 0x100) >> 8; //excludes the cargo value byte new_cargo_type = p2 & 0xFF; //gets the cargo number + AircraftVehicleInfo *avi; SET_EXPENSES_TYPE(EXPENSES_AIRCRAFT_RUN); v = GetVehicle(p1); + avi = AircraftVehInfo(v->engine_type); if (!CheckOwnership(v->owner) || (!CheckStoppedInHangar(v) && !(SkipStoppedInHangerCheck))) return CMD_ERROR; - pass = AircraftVehInfo(v->engine_type)->passenger_capacity; - if (new_cargo_type != CT_PASSENGERS) { - pass >>= 1; - if (new_cargo_type != CT_GOODS) - pass >>= 1; + switch (new_cargo_type) { + case CT_PASSENGERS: + pass = avi->passenger_capacity; + break; + case CT_MAIL: + pass = avi->passenger_capacity + avi->mail_capacity; + break; + case CT_GOODS: + pass = avi->passenger_capacity + avi->mail_capacity; + pass /= 2; + break; + default: + pass = avi->passenger_capacity + avi->mail_capacity; + pass /= 4; + break; } _aircraft_refit_capacity = pass; @@ -440,7 +452,7 @@ int32 CmdRefitAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2) v->cargo_cap = pass; u = v->next; - mail = AircraftVehInfo(v->engine_type)->mail_capacity; + mail = avi->mail_capacity; if (new_cargo_type != CT_PASSENGERS) { mail = 0; } |