mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-22 07:06:01 +00:00
(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
This commit is contained in:
parent
e58739c559
commit
9a4465f9c0
@ -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;
|
||||
}
|
||||
|
@ -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) {
|
||||
|
4
ttd.h
4
ttd.h
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user