diff options
author | tron <tron@openttd.org> | 2007-02-15 20:35:45 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2007-02-15 20:35:45 +0000 |
commit | 0697701b33df7c16bd79d2c072e9f7b40b30ef8d (patch) | |
tree | 99a9c4e1fd6274538c34dd8761f6f530815a6691 /src/aircraft_cmd.cpp | |
parent | 5231f5669dcb1f4caa641696a16c8517239a5303 (diff) | |
download | openttd-0697701b33df7c16bd79d2c072e9f7b40b30ef8d.tar.xz |
(svn r8748) -Fix
-Codechange: Do not hardcode the airports with a short airstrip anymore, but make it a flag in AirportFTAClass
Diffstat (limited to 'src/aircraft_cmd.cpp')
-rw-r--r-- | src/aircraft_cmd.cpp | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index 2108cadc3..7c25d417d 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -74,22 +74,23 @@ static StationID FindNearestHangar(const Vehicle *v) TileIndex vtile = TileVirtXY(v->x_pos, v->y_pos); FOR_ALL_STATIONS(st) { - if (st->owner == v->owner && st->facilities & FACIL_AIRPORT && - GetAirport(st->airport_type)->nof_depots > 0) { - uint distance; - - // don't crash the plane if we know it can't land at the airport - if ((AircraftVehInfo(v->engine_type)->subtype & AIR_FAST) && - (st->airport_type == AT_SMALL || st->airport_type == AT_COMMUTER) && - !_cheats.no_jetcrash.value) - continue; + if (st->owner != v->owner || !(st->facilities & FACIL_AIRPORT)) continue; + + const AirportFTAClass *afc = GetAirport(st->airport_type); + if (afc->nof_depots == 0 || ( + /* don't crash the plane if we know it can't land at the airport */ + afc->flags & AirportFTAClass::SHORT_STRIP && + 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 - distance = DistanceSquare(vtile, st->airport_tile); - if (distance < best || index == INVALID_STATION) { - best = distance; - index = st->index; - } + // v->tile can't be used here, when aircraft is flying v->tile is set to 0 + uint distance = DistanceSquare(vtile, st->airport_tile); + if (distance < best || index == INVALID_STATION) { + best = distance; + index = st->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 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; } |