mirror of https://github.com/OpenTTD/OpenTTD.git
(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;
|
int32 cost;
|
||||||
byte SkipStoppedInHangerCheck = (p2 & 0x100) >> 8; //excludes the cargo value
|
byte SkipStoppedInHangerCheck = (p2 & 0x100) >> 8; //excludes the cargo value
|
||||||
byte new_cargo_type = p2 & 0xFF; //gets the cargo number
|
byte new_cargo_type = p2 & 0xFF; //gets the cargo number
|
||||||
|
AircraftVehicleInfo *avi;
|
||||||
|
|
||||||
SET_EXPENSES_TYPE(EXPENSES_AIRCRAFT_RUN);
|
SET_EXPENSES_TYPE(EXPENSES_AIRCRAFT_RUN);
|
||||||
|
|
||||||
v = GetVehicle(p1);
|
v = GetVehicle(p1);
|
||||||
|
avi = AircraftVehInfo(v->engine_type);
|
||||||
if (!CheckOwnership(v->owner) || (!CheckStoppedInHangar(v) && !(SkipStoppedInHangerCheck)))
|
if (!CheckOwnership(v->owner) || (!CheckStoppedInHangar(v) && !(SkipStoppedInHangerCheck)))
|
||||||
return CMD_ERROR;
|
return CMD_ERROR;
|
||||||
|
|
||||||
pass = AircraftVehInfo(v->engine_type)->passenger_capacity;
|
switch (new_cargo_type) {
|
||||||
if (new_cargo_type != CT_PASSENGERS) {
|
case CT_PASSENGERS:
|
||||||
pass >>= 1;
|
pass = avi->passenger_capacity;
|
||||||
if (new_cargo_type != CT_GOODS)
|
break;
|
||||||
pass >>= 1;
|
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;
|
_aircraft_refit_capacity = pass;
|
||||||
|
|
||||||
|
@ -440,7 +452,7 @@ int32 CmdRefitAircraft(int x, int y, uint32 flags, uint32 p1, uint32 p2)
|
||||||
v->cargo_cap = pass;
|
v->cargo_cap = pass;
|
||||||
|
|
||||||
u = v->next;
|
u = v->next;
|
||||||
mail = AircraftVehInfo(v->engine_type)->mail_capacity;
|
mail = avi->mail_capacity;
|
||||||
if (new_cargo_type != CT_PASSENGERS) {
|
if (new_cargo_type != CT_PASSENGERS) {
|
||||||
mail = 0;
|
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 };
|
#define MAX_REFIT 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_normal[] = {
|
||||||
const byte _aircraft_refit_candy[] = { 0,1,3,5,7,8,9,6,4,10,11,0xFF };
|
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] = {
|
const byte * const _aircraft_refit_types[4] = {
|
||||||
_aircraft_refit_normal, _aircraft_refit_arctic, _aircraft_refit_desert, _aircraft_refit_candy
|
_aircraft_refit_normal, _aircraft_refit_arctic, _aircraft_refit_desert, _aircraft_refit_candy
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#undef MAX_REFIT
|
||||||
|
|
||||||
static void AircraftRefitWndProc(Window *w, WindowEvent *e)
|
static void AircraftRefitWndProc(Window *w, WindowEvent *e)
|
||||||
{
|
{
|
||||||
switch(e->event) {
|
switch(e->event) {
|
||||||
|
|
4
ttd.h
4
ttd.h
|
@ -239,14 +239,18 @@ enum {
|
||||||
CT_FOOD = 11,
|
CT_FOOD = 11,
|
||||||
|
|
||||||
// Arctic
|
// Arctic
|
||||||
|
CT_WHEAT = 6,
|
||||||
CT_HILLY_UNUSED = 8,
|
CT_HILLY_UNUSED = 8,
|
||||||
CT_PAPER = 9,
|
CT_PAPER = 9,
|
||||||
|
CT_GOLD = 10,
|
||||||
|
|
||||||
// Tropic
|
// Tropic
|
||||||
CT_RUBBER = 1,
|
CT_RUBBER = 1,
|
||||||
CT_FRUIT = 4,
|
CT_FRUIT = 4,
|
||||||
|
CT_MAIZE = 6,
|
||||||
CT_COPPER_ORE = 8,
|
CT_COPPER_ORE = 8,
|
||||||
CT_WATER = 9,
|
CT_WATER = 9,
|
||||||
|
CT_DIAMONDS = 10,
|
||||||
|
|
||||||
// Toyland
|
// Toyland
|
||||||
CT_SUGAR = 1,
|
CT_SUGAR = 1,
|
||||||
|
|
|
@ -597,6 +597,14 @@ static bool CanFillVehicle_FullLoadAny(Vehicle *v)
|
||||||
{
|
{
|
||||||
uint32 full = 0, not_full = 0;
|
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.
|
// patch should return "true" to continue loading, i.e. when there is no cargo type that is fully loaded.
|
||||||
do {
|
do {
|
||||||
//Should never happen, but just in case future additions change this
|
//Should never happen, but just in case future additions change this
|
||||||
|
|
Loading…
Reference in New Issue