From 9a4465f9c0db69b3d9da903b67b678a0ee3a565e Mon Sep 17 00:00:00 2001 From: celestar Date: Fri, 7 Jan 2005 09:51:16 +0000 Subject: (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 --- aircraft_cmd.c | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) (limited to 'aircraft_cmd.c') 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; } -- cgit v1.2.3-54-g00ecf