1
0
Fork 0

(svn r12343) -Fix (r12293): Slow helicopters never got the 'chance' to finish the landing routine.

release/0.6
peter1138 2008-03-05 18:33:31 +00:00
parent cd411ab75a
commit b4a51cd28d
1 changed files with 26 additions and 24 deletions

View File

@ -1105,34 +1105,36 @@ static bool AircraftController(Vehicle *v)
/* Helicopter landing. */ /* Helicopter landing. */
if (amd->flag & AMED_HELI_LOWER) { if (amd->flag & AMED_HELI_LOWER) {
count = UpdateAircraftSpeed(v); if (st->airport_tile == 0) {
if (count > 0) { /* FIXME - AircraftController -> if station no longer exists, do not land
if (st->airport_tile == 0) { * helicopter will circle until sign disappears, then go to next order
/* FIXME - AircraftController -> if station no longer exists, do not land * what to do when it is the only order left, right now it just stays in 1 place */
* helicopter will circle until sign disappears, then go to next order v->u.air.state = FLYING;
* what to do when it is the only order left, right now it just stays in 1 place */ UpdateAircraftCache(v);
v->u.air.state = FLYING; AircraftNextAirportPos_and_Order(v);
UpdateAircraftCache(v); return false;
AircraftNextAirportPos_and_Order(v); }
return false;
}
/* Vehicle is now at the airport. */ /* Vehicle is now at the airport. */
v->tile = st->airport_tile; v->tile = st->airport_tile;
/* Find altitude of landing position. */ /* Find altitude of landing position. */
int z = GetSlopeZ(x, y) + 1 + afc->delta_z; int z = GetSlopeZ(x, y) + 1 + afc->delta_z;
if (z == v->z_pos) { if (z == v->z_pos) {
Vehicle *u = v->Next()->Next(); Vehicle *u = v->Next()->Next();
/* Increase speed of rotors. When speed is 80, we've landed. */ /* Increase speed of rotors. When speed is 80, we've landed. */
if (u->cur_speed >= 80) return true; if (u->cur_speed >= 80) return true;
u->cur_speed += 4; u->cur_speed += 4;
} else if (v->z_pos > z) { } else {
SetAircraftPosition(v, v->x_pos, v->y_pos, max(v->z_pos - count, z)); count = UpdateAircraftSpeed(v);
} else { if (count > 0) {
SetAircraftPosition(v, v->x_pos, v->y_pos, min(v->z_pos + count, z)); if (v->z_pos > z) {
SetAircraftPosition(v, v->x_pos, v->y_pos, max(v->z_pos - count, z));
} else {
SetAircraftPosition(v, v->x_pos, v->y_pos, min(v->z_pos + count, z));
}
} }
} }
return false; return false;