Mercurial > hg > openttd
changeset 924:4fb14df162e1 draft
(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
author | celestar <celestar@openttd.org> |
---|---|
date | Fri, 07 Jan 2005 09:51:16 +0000 |
parents | dffc734e55a1 |
children | 390dab6bc78b |
files | aircraft_cmd.c aircraft_gui.c ttd.h vehicle.c |
diffstat | 4 files changed, 73 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/aircraft_cmd.c +++ b/aircraft_cmd.c @@ -416,18 +416,30 @@ 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 @@ 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; }
--- a/aircraft_gui.c +++ b/aircraft_gui.c @@ -204,15 +204,54 @@ } } -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) {
--- a/ttd.h +++ b/ttd.h @@ -239,14 +239,18 @@ 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,
--- a/vehicle.c +++ b/vehicle.c @@ -597,6 +597,14 @@ { 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