summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authortron <tron@openttd.org>2007-02-03 07:47:00 +0000
committertron <tron@openttd.org>2007-02-03 07:47:00 +0000
commit8679ce4638fdc19a980b0af0a12db4de2f6badd2 (patch)
treeab75777c47352b9bf511ac47f07d902a3b9c78b4 /src
parent2f249e650b05238cc4248640c2d8de83a3f77d19 (diff)
downloadopenttd-8679ce4638fdc19a980b0af0a12db4de2f6badd2.tar.xz
(svn r8547) -Fix
Remove redundant second retrieval of the station and airport when building an aircraft
Diffstat (limited to 'src')
-rw-r--r--src/aircraft_cmd.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 8e45e9001..b3a1bb793 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -210,7 +210,6 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
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 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
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 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
* 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++) {