summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2007-12-01 14:04:16 +0000
committerbelugas <belugas@openttd.org>2007-12-01 14:04:16 +0000
commit61dc1f8609e4f4227e51eea8c468224452152429 (patch)
treede216336b99b386bd8a99156e6f416a24ffdab97
parent4f5ae3b66fa3ee0c66177e91f363d81fccb66870 (diff)
downloadopenttd-61dc1f8609e4f4227e51eea8c468224452152429.tar.xz
(svn r11546) -Fix[FS#1496]: If ever the air/heli port is suddenly not available while the "chopper" is descending, just go back into flying.
The code should have been better written, but in respect of newgrf_port branch, i prefer minimalist intervention
-rw-r--r--src/aircraft_cmd.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 96276611b..df79cb73d 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -1042,7 +1042,17 @@ static bool AircraftController(Vehicle *v)
tile = st->xy;
/* Jump into our "holding pattern" state machine if possible */
- if (v->u.air.pos >= afc->nofelements) v->u.air.pos = v->u.air.previous_pos = AircraftGetEntryPoint(v, afc);
+ if (v->u.air.pos >= afc->nofelements) {
+ v->u.air.pos = v->u.air.previous_pos = AircraftGetEntryPoint(v, afc);
+ } else {
+ /* If not possible, just get out of here fast */
+ v->u.air.state = FLYING;
+ UpdateAircraftCache(v);
+ AircraftNextAirportPos_and_Order(v);
+ /* get aircraft back on running altitude */
+ SetAircraftPosition(v, v->x_pos, v->y_pos, GetAircraftFlyingAltitude(v));
+ return false;
+ }
}
/* get airport moving data */