Mercurial > hg > openttd
changeset 5919:f16dbc00507f draft
(svn r8547) -Fix
Remove redundant second retrieval of the station and airport when building an aircraft
author | tron <tron@openttd.org> |
---|---|
date | Sat, 03 Feb 2007 07:47:00 +0000 |
parents | 8fc3143d239c |
children | 944cc709024f |
files | src/aircraft_cmd.cpp |
diffstat | 1 files changed, 3 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -210,7 +210,6 @@ Vehicle *vl[3]; UnitID unit_num; const AircraftVehicleInfo *avi; - const AirportFTAClass* ap; if (!IsEngineBuildable(p1, VEH_Aircraft, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE); @@ -226,8 +225,9 @@ avi = AircraftVehInfo(p1); // Prevent building aircraft types at places which can't handle them - ap = GetAirport(GetStationByTile(tile)->airport_type); - if ((avi->subtype & AIR_CTOL ? HELICOPTERS_ONLY : AIRCRAFT_ONLY) == ap->acc_planes) { + const Station* st = GetStationByTile(tile); + const AirportFTAClass* apc = GetAirport(st->airport_type); + if ((avi->subtype & AIR_CTOL ? HELICOPTERS_ONLY : AIRCRAFT_ONLY) == apc->acc_planes) { return CMD_ERROR; } @@ -348,8 +348,6 @@ * layout for #th position of depot. Since layout must start with a listing * of all depots, it is simple */ { - const Station* st = GetStationByTile(tile); - const AirportFTAClass* apc = GetAirport(st->airport_type); uint i; for (i = 0; i < apc->nof_depots; i++) {