|
@@ -35,16 +35,16 @@
|
|
|
#include "engine_base.h"
|
|
|
#include "core/random_func.hpp"
|
|
|
#include "core/backup_type.hpp"
|
|
|
|
|
|
#include "table/strings.h"
|
|
|
|
|
|
static const uint ROTOR_Z_OFFSET = 5; ///< Z Offset between helicopter- and rotorsprite.
|
|
|
static const int ROTOR_Z_OFFSET = 5; ///< Z Offset between helicopter- and rotorsprite.
|
|
|
|
|
|
static const uint PLANE_HOLDING_ALTITUDE = 150; ///< Altitude of planes in holding pattern (= lowest flight altitude).
|
|
|
static const uint HELI_FLIGHT_ALTITUDE = 184; ///< Normal flight altitude of helicopters.
|
|
|
static const int PLANE_HOLDING_ALTITUDE = 150; ///< Altitude of planes in holding pattern (= lowest flight altitude).
|
|
|
static const int HELI_FLIGHT_ALTITUDE = 184; ///< Normal flight altitude of helicopters.
|
|
|
|
|
|
|
|
|
void Aircraft::UpdateDeltaXY(Direction direction)
|
|
|
{
|
|
|
this->x_offs = -1;
|
|
|
this->y_offs = -1;
|
|
@@ -927,13 +927,13 @@ static bool AircraftController(Aircraft
|
|
|
|
|
|
v->tile = gp.new_tile;
|
|
|
/* If vehicle is in the air, use tile coordinate 0. */
|
|
|
if (amd.flag & (AMED_TAKEOFF | AMED_SLOWTURN | AMED_LAND)) v->tile = 0;
|
|
|
|
|
|
/* Adjust Z for land or takeoff? */
|
|
|
uint z = v->z_pos;
|
|
|
int z = v->z_pos;
|
|
|
|
|
|
if (amd.flag & AMED_TAKEOFF) {
|
|
|
z = min(z + 2, GetAircraftFlyingAltitude(v));
|
|
|
}
|
|
|
|
|
|
/* Let the plane drop from normal flight altitude to holding pattern altitude */
|
|
@@ -947,13 +947,13 @@ static bool AircraftController(Aircraft
|
|
|
AircraftNextAirportPos_and_Order(v);
|
|
|
/* get aircraft back on running altitude */
|
|
|
SetAircraftPosition(v, gp.x, gp.y, GetAircraftFlyingAltitude(v));
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
uint curz = GetSlopePixelZ(x + amd.x, y + amd.y) + 1;
|
|
|
int curz = GetSlopePixelZ(x + amd.x, y + amd.y) + 1;
|
|
|
|
|
|
/* We're not flying below our destination, right? */
|
|
|
assert(curz <= z);
|
|
|
int t = max(1U, dist - 4);
|
|
|
int delta = z - curz;
|
|
|
|
|
@@ -963,13 +963,13 @@ static bool AircraftController(Aircraft
|
|
|
}
|
|
|
if (z < curz) z = curz;
|
|
|
}
|
|
|
|
|
|
/* We've landed. Decrease speed when we're reaching end of runway. */
|
|
|
if (amd.flag & AMED_BRAKE) {
|
|
|
uint curz = GetSlopePixelZ(x, y) + 1;
|
|
|
int curz = GetSlopePixelZ(x, y) + 1;
|
|
|
|
|
|
if (z > curz) {
|
|
|
z--;
|
|
|
} else if (z < curz) {
|
|
|
z++;
|
|
|
}
|