diff options
author | tron <tron@openttd.org> | 2007-02-15 07:43:06 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2007-02-15 07:43:06 +0000 |
commit | e62036f5e9d2256ec59fc25a6ef14baeddbd82ea (patch) | |
tree | d09c3b4c1b06a7f956808046aadcd50adb3aa51e /src/newgrf_engine.cpp | |
parent | 0c330c1b1b11aae3117488b0d44fa7ef2474ffef (diff) | |
download | openttd-e62036f5e9d2256ec59fc25a6ef14baeddbd82ea.tar.xz |
(svn r8743) -Fix
-Codechange: Add a Z adjustment attribute for helicopter pads to AirportFTAClass to get rid of some special cases for oilrigs and heliports
Diffstat (limited to 'src/newgrf_engine.cpp')
-rw-r--r-- | src/newgrf_engine.cpp | 43 |
1 files changed, 11 insertions, 32 deletions
diff --git a/src/newgrf_engine.cpp b/src/newgrf_engine.cpp index 08e910cf1..d052d16bb 100644 --- a/src/newgrf_engine.cpp +++ b/src/newgrf_engine.cpp @@ -288,7 +288,8 @@ enum { static byte MapAircraftMovementState(const Vehicle *v) { const Station *st = GetStation(v->u.air.targetairport); - byte amdflag = GetAirport(st->airport_type)->MovingData(v->u.air.pos)->flag; + const AirportFTAClass *afc = GetAirport(st->airport_type); + byte amdflag = afc->MovingData(v->u.air.pos)->flag; switch (v->u.air.state) { case HANGAR: @@ -347,26 +348,11 @@ static byte MapAircraftMovementState(const Vehicle *v) return AMS_TTDP_CLIMBING; case HELITAKEOFF: // Helicopter is moving to take off position. - switch (st->airport_type) { - case AT_SMALL: - case AT_LARGE: - case AT_METROPOLITAN: - case AT_INTERNATIONAL: - case AT_COMMUTER: - case AT_INTERCON: - /* Note, Helidepot and Helistation are treated as airports as - * helicopters are taking off from ground level. */ - case AT_HELIDEPOT: - case AT_HELISTATION: - if (amdflag & AMED_HELI_RAISE) return AMS_TTDP_HELI_TAKEOFF_AIRPORT; - return AMS_TTDP_TO_JUNCTION; - - case AT_HELIPORT: - case AT_OILRIG: - return AMS_TTDP_HELI_TAKEOFF_HELIPORT; - - default: - return AMS_TTDP_HELI_TAKEOFF_AIRPORT; + if (afc->delta_z == 0) { + return amdflag & AMED_HELI_RAISE ? + AMS_TTDP_HELI_TAKEOFF_AIRPORT : AMS_TTDP_TO_JUNCTION; + } else { + return AMS_TTDP_HELI_TAKEOFF_HELIPORT; } case FLYING: @@ -383,18 +369,11 @@ static byte MapAircraftMovementState(const Vehicle *v) case HELILANDING: case HELIENDLANDING: // Helicoptor is decending. if (amdflag & AMED_HELI_LOWER) { - switch (st->airport_type) { - case AT_HELIPORT: - case AT_OILRIG: - return AMS_TTDP_HELI_LAND_HELIPORT; - - default: - /* Note, Helidepot and Helistation are treated as airports as - * helicopters are landing at ground level. */ - return AMS_TTDP_HELI_LAND_AIRPORT; - } + return afc->delta_z == 0 ? + AMS_TTDP_HELI_LAND_AIRPORT : AMS_TTDP_HELI_LAND_HELIPORT; + } else { + return AMS_TTDP_FLIGHT_TO_TOWER; } - return AMS_TTDP_FLIGHT_TO_TOWER; default: return AMS_TTDP_HANGAR; |