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 | b2c47cf7d6465dbe6bc1f599ecdcb0947f1a95d7 (patch) | |
tree | dd060d5dca61f8a204e1ed8e93a87362d44f4945 | |
parent | 45284100533d14999c7dee487d05d9c0f63c7111 (diff) | |
download | openttd-b2c47cf7d6465dbe6bc1f599ecdcb0947f1a95d7.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
-rw-r--r-- | aircraft_cmd.c | 24 | ||||
-rw-r--r-- | aircraft_gui.c | 47 | ||||
-rw-r--r-- | ttd.h | 4 | ||||
-rw-r--r-- | vehicle.c | 8 |
4 files changed, 73 insertions, 10 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; } diff --git a/aircraft_gui.c b/aircraft_gui.c index 0439d71db..33f81cf9d 100644 --- a/aircraft_gui.c +++ b/aircraft_gui.c @@ -204,15 +204,54 @@ static void ShowBuildAircraftWindow(uint tile) } } -const byte _aircraft_refit_normal[] = { 0,1,4,5,6,7,8,9,10,0xFF }; -const byte _aircraft_refit_arctic[] = { 0,1,4,5,6,7,9,11,10,0xFF }; -const byte _aircraft_refit_desert[] = { 0,4,5,8,6,7,9,10,0xFF }; -const byte _aircraft_refit_candy[] = { 0,1,3,5,7,8,9,6,4,10,11,0xFF }; +#define MAX_REFIT 0xFF + +const byte _aircraft_refit_normal[] = { + CT_PASSENGERS, + CT_MAIL, + CT_GOODS, + CT_VALUABLES, + MAX_REFIT +}; + +const byte _aircraft_refit_arctic[] = { + CT_PASSENGERS, + CT_MAIL, + CT_GOODS, + CT_FOOD, + MAX_REFIT +}; + +const byte _aircraft_refit_desert[] = { + CT_PASSENGERS, + CT_MAIL, + CT_FRUIT, + CT_GOODS, + CT_DIAMONDS, + MAX_REFIT +}; + +const byte _aircraft_refit_candy[] = { + CT_PASSENGERS, + CT_SUGAR, + CT_TOYS, + CT_CANDY, + CT_COLA, + CT_COTTON_CANDY, + CT_BUBBLES, + CT_TOFFEE, + CT_BATTERIES, + CT_PLASTIC, + CT_FIZZY_DRINKS, + MAX_REFIT +}; const byte * const _aircraft_refit_types[4] = { _aircraft_refit_normal, _aircraft_refit_arctic, _aircraft_refit_desert, _aircraft_refit_candy }; +#undef MAX_REFIT + static void AircraftRefitWndProc(Window *w, WindowEvent *e) { switch(e->event) { @@ -239,14 +239,18 @@ enum { CT_FOOD = 11, // Arctic + CT_WHEAT = 6, CT_HILLY_UNUSED = 8, CT_PAPER = 9, + CT_GOLD = 10, // Tropic CT_RUBBER = 1, CT_FRUIT = 4, + CT_MAIZE = 6, CT_COPPER_ORE = 8, CT_WATER = 9, + CT_DIAMONDS = 10, // Toyland CT_SUGAR = 1, @@ -597,6 +597,14 @@ static bool CanFillVehicle_FullLoadAny(Vehicle *v) { uint32 full = 0, not_full = 0; + //special handling of aircraft + + //if the aircraft carries passengers and is NOT full, then + //continue loading, no matter how much mail is in + if ((v->type == VEH_Aircraft) && (v->cargo_type == CT_PASSENGERS) && (v->cargo_cap != v->cargo_count)) { + return true; + } + // patch should return "true" to continue loading, i.e. when there is no cargo type that is fully loaded. do { //Should never happen, but just in case future additions change this |