Mercurial > hg > openttd
changeset 6590:e6e1eda36451 draft
(svn r9804) -Fix (r9761): Update aircraft cached information when its 'pos' changes, as well as 'state'. (Thanks to bulb)
author | peter1138 <peter1138@openttd.org> |
---|---|
date | Sun, 06 May 2007 21:10:49 +0000 |
parents | 3c89f72535f3 |
children | afa528378bda |
files | src/aircraft_cmd.cpp |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -1091,6 +1091,7 @@ * helicopter will circle until sign disappears, then go to next order * what to do when it is the only order left, right now it just stays in 1 place */ v->u.air.state = FLYING; + UpdateAircraftCache(v); AircraftNextAirportPos_and_Order(v); return false; } @@ -1205,6 +1206,7 @@ if (st->airport_tile == 0) { /* Airport has been removed, abort the landing procedure */ v->u.air.state = FLYING; + UpdateAircraftCache(v); AircraftNextAirportPos_and_Order(v); /* get aircraft back on running altitude */ SetAircraftPosition(v, gp.x, gp.y, GetAircraftFlyingAltitude(v)); @@ -1879,7 +1881,7 @@ byte prev_state = v->u.air.state; _aircraft_state_handlers[v->u.air.state](v, apc); if (v->u.air.state != FLYING) v->u.air.previous_pos = prev_pos; - if (v->u.air.state != prev_state) UpdateAircraftCache(v); + if (v->u.air.state != prev_state || v->u.air.pos != prev_pos) UpdateAircraftCache(v); return true; } @@ -1889,6 +1891,7 @@ if (current->next == NULL) { if (AirportSetBlocks(v, current, apc)) { v->u.air.pos = current->next_position; + UpdateAircraftCache(v); } // move to next position return false; } @@ -1899,6 +1902,7 @@ if (v->u.air.state == current->heading || current->heading == TO_ALL) { if (AirportSetBlocks(v, current, apc)) { v->u.air.pos = current->next_position; + UpdateAircraftCache(v); } // move to next position return false; } @@ -2203,6 +2207,7 @@ if (v->u.air.state >= FLYING) { // circle around v->u.air.pos = v->u.air.previous_pos = AircraftGetEntryPoint(v, ap); v->u.air.state = FLYING; + UpdateAircraftCache(v); /* landing plane needs to be reset to flying height (only if in pause mode upgrade, * in normal mode, plane is reset in AircraftController. It doesn't hurt for FLYING */ GetNewVehiclePosResult gp = GetNewVehiclePos(v); @@ -2216,6 +2221,7 @@ for (uint cnt = 0; cnt < ap->nofelements; cnt++) { if (ap->layout[cnt].heading == takeofftype) { v->u.air.pos = ap->layout[cnt].position; + UpdateAircraftCache(v); break; } }