mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-07 14:58:22 +00:00
(svn r8748) -Fix
-Codechange: Do not hardcode the airports with a short airstrip anymore, but make it a flag in AirportFTAClass
This commit is contained in:
parent
5231f5669d
commit
0697701b33
@ -74,22 +74,23 @@ static StationID FindNearestHangar(const Vehicle *v)
|
|||||||
TileIndex vtile = TileVirtXY(v->x_pos, v->y_pos);
|
TileIndex vtile = TileVirtXY(v->x_pos, v->y_pos);
|
||||||
|
|
||||||
FOR_ALL_STATIONS(st) {
|
FOR_ALL_STATIONS(st) {
|
||||||
if (st->owner == v->owner && st->facilities & FACIL_AIRPORT &&
|
if (st->owner != v->owner || !(st->facilities & FACIL_AIRPORT)) continue;
|
||||||
GetAirport(st->airport_type)->nof_depots > 0) {
|
|
||||||
uint distance;
|
|
||||||
|
|
||||||
// don't crash the plane if we know it can't land at the airport
|
const AirportFTAClass *afc = GetAirport(st->airport_type);
|
||||||
if ((AircraftVehInfo(v->engine_type)->subtype & AIR_FAST) &&
|
if (afc->nof_depots == 0 || (
|
||||||
(st->airport_type == AT_SMALL || st->airport_type == AT_COMMUTER) &&
|
/* don't crash the plane if we know it can't land at the airport */
|
||||||
!_cheats.no_jetcrash.value)
|
afc->flags & AirportFTAClass::SHORT_STRIP &&
|
||||||
continue;
|
AircraftVehInfo(v->engine_type)->subtype & AIR_FAST &&
|
||||||
|
!_cheats.no_jetcrash.value
|
||||||
|
)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// v->tile can't be used here, when aircraft is flying v->tile is set to 0
|
// v->tile can't be used here, when aircraft is flying v->tile is set to 0
|
||||||
distance = DistanceSquare(vtile, st->airport_tile);
|
uint distance = DistanceSquare(vtile, st->airport_tile);
|
||||||
if (distance < best || index == INVALID_STATION) {
|
if (distance < best || index == INVALID_STATION) {
|
||||||
best = distance;
|
best = distance;
|
||||||
index = st->index;
|
index = st->index;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return index;
|
return index;
|
||||||
@ -1368,7 +1369,9 @@ static void MaybeCrashAirplane(Vehicle *v)
|
|||||||
|
|
||||||
//FIXME -- MaybeCrashAirplane -> increase crashing chances of very modern airplanes on smaller than AT_METROPOLITAN airports
|
//FIXME -- MaybeCrashAirplane -> increase crashing chances of very modern airplanes on smaller than AT_METROPOLITAN airports
|
||||||
prob = 0x10000 / 1500;
|
prob = 0x10000 / 1500;
|
||||||
if (((st->airport_type == AT_SMALL) || (st->airport_type == AT_COMMUTER)) && (AircraftVehInfo(v->engine_type)->subtype & AIR_FAST) && !_cheats.no_jetcrash.value) {
|
if (GetAirport(st->airport_type)->flags & AirportFTAClass::SHORT_STRIP &&
|
||||||
|
AircraftVehInfo(v->engine_type)->subtype & AIR_FAST &&
|
||||||
|
!_cheats.no_jetcrash.value) {
|
||||||
prob = 0x10000 / 20;
|
prob = 0x10000 / 20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ void InitializeAirports(void)
|
|||||||
_airport_terminal_country,
|
_airport_terminal_country,
|
||||||
NULL,
|
NULL,
|
||||||
16,
|
16,
|
||||||
AirportFTAClass::ALL,
|
AirportFTAClass::ALL | AirportFTAClass::SHORT_STRIP,
|
||||||
_airport_fta_country,
|
_airport_fta_country,
|
||||||
_airport_depots_country,
|
_airport_depots_country,
|
||||||
lengthof(_airport_depots_country),
|
lengthof(_airport_depots_country),
|
||||||
@ -128,7 +128,7 @@ void InitializeAirports(void)
|
|||||||
_airport_terminal_commuter,
|
_airport_terminal_commuter,
|
||||||
_airport_helipad_commuter,
|
_airport_helipad_commuter,
|
||||||
22,
|
22,
|
||||||
AirportFTAClass::ALL,
|
AirportFTAClass::ALL | AirportFTAClass::SHORT_STRIP,
|
||||||
_airport_fta_commuter,
|
_airport_fta_commuter,
|
||||||
_airport_depots_commuter,
|
_airport_depots_commuter,
|
||||||
lengthof(_airport_depots_commuter),
|
lengthof(_airport_depots_commuter),
|
||||||
|
@ -125,6 +125,7 @@ typedef struct AirportFTAClass {
|
|||||||
PLANES = 0x1,
|
PLANES = 0x1,
|
||||||
HELICOPTERS = 0x2,
|
HELICOPTERS = 0x2,
|
||||||
ALL = PLANES | HELICOPTERS,
|
ALL = PLANES | HELICOPTERS,
|
||||||
|
SHORT_STRIP = 0x4
|
||||||
};
|
};
|
||||||
|
|
||||||
AirportFTAClass(
|
AirportFTAClass(
|
||||||
@ -163,6 +164,9 @@ typedef struct AirportFTAClass {
|
|||||||
byte delta_z; // Z adjustment for helicopter pads
|
byte delta_z; // Z adjustment for helicopter pads
|
||||||
} AirportFTAClass;
|
} AirportFTAClass;
|
||||||
|
|
||||||
|
DECLARE_ENUM_AS_BIT_SET(AirportFTAClass::Flags)
|
||||||
|
|
||||||
|
|
||||||
// internal structure used in openttd - Finite sTate mAchine --> FTA
|
// internal structure used in openttd - Finite sTate mAchine --> FTA
|
||||||
typedef struct AirportFTA {
|
typedef struct AirportFTA {
|
||||||
struct AirportFTA *next; // possible extra movement choices from this position
|
struct AirportFTA *next; // possible extra movement choices from this position
|
||||||
|
Loading…
Reference in New Issue
Block a user