mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 10:30:28 +00:00
(svn r23110) -Codechange: let the flying altitude return ints are well
This commit is contained in:
parent
81f583de47
commit
9782b7bb0a
@ -34,7 +34,7 @@ void UpdateAircraftCache(Aircraft *v);
|
|||||||
void AircraftLeaveHangar(Aircraft *v, Direction exit_dir);
|
void AircraftLeaveHangar(Aircraft *v, Direction exit_dir);
|
||||||
void AircraftNextAirportPos_and_Order(Aircraft *v);
|
void AircraftNextAirportPos_and_Order(Aircraft *v);
|
||||||
void SetAircraftPosition(Aircraft *v, int x, int y, int z);
|
void SetAircraftPosition(Aircraft *v, int x, int y, int z);
|
||||||
byte GetAircraftFlyingAltitude(const Aircraft *v);
|
int GetAircraftFlyingAltitude(const Aircraft *v);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Aircraft, helicopters, rotors and their shadows belong to this class.
|
* Aircraft, helicopters, rotors and their shadows belong to this class.
|
||||||
|
@ -630,14 +630,14 @@ static int UpdateAircraftSpeed(Aircraft *v, uint speed_limit = SPEED_LIMIT_NONE,
|
|||||||
* @param v The vehicle. Should be an aircraft
|
* @param v The vehicle. Should be an aircraft
|
||||||
* @returns Altitude in pixel units
|
* @returns Altitude in pixel units
|
||||||
*/
|
*/
|
||||||
byte GetAircraftFlyingAltitude(const Aircraft *v)
|
int GetAircraftFlyingAltitude(const Aircraft *v)
|
||||||
{
|
{
|
||||||
if (v->subtype == AIR_HELICOPTER) return HELI_FLIGHT_ALTITUDE;
|
if (v->subtype == AIR_HELICOPTER) return HELI_FLIGHT_ALTITUDE;
|
||||||
|
|
||||||
/* Make sure Aircraft fly no lower so that they don't conduct
|
/* Make sure Aircraft fly no lower so that they don't conduct
|
||||||
* CFITs (controlled flight into terrain)
|
* CFITs (controlled flight into terrain)
|
||||||
*/
|
*/
|
||||||
byte base_altitude = PLANE_HOLDING_ALTITUDE;
|
int base_altitude = PLANE_HOLDING_ALTITUDE;
|
||||||
|
|
||||||
/* Make sure eastbound and westbound planes do not "crash" into each
|
/* Make sure eastbound and westbound planes do not "crash" into each
|
||||||
* other by providing them with vertical seperation
|
* other by providing them with vertical seperation
|
||||||
@ -776,7 +776,7 @@ static bool AircraftController(Aircraft *v)
|
|||||||
count = UpdateAircraftSpeed(v);
|
count = UpdateAircraftSpeed(v);
|
||||||
if (count > 0) {
|
if (count > 0) {
|
||||||
v->tile = 0;
|
v->tile = 0;
|
||||||
byte z_dest = GetAircraftFlyingAltitude(v);
|
int z_dest = GetAircraftFlyingAltitude(v);
|
||||||
|
|
||||||
/* Reached altitude? */
|
/* Reached altitude? */
|
||||||
if (v->z_pos >= z_dest) {
|
if (v->z_pos >= z_dest) {
|
||||||
|
@ -315,7 +315,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
|
|||||||
};
|
};
|
||||||
SpriteID pylon_base = (halftile_corner != CORNER_INVALID && HasBit(edge_corners[i], halftile_corner)) ? pylon_halftile : pylon_normal;
|
SpriteID pylon_base = (halftile_corner != CORNER_INVALID && HasBit(edge_corners[i], halftile_corner)) ? pylon_halftile : pylon_normal;
|
||||||
TileIndex neighbour = ti->tile + TileOffsByDiagDir(i);
|
TileIndex neighbour = ti->tile + TileOffsByDiagDir(i);
|
||||||
byte elevation = GetPCPElevation(ti->tile, i);
|
int elevation = GetPCPElevation(ti->tile, i);
|
||||||
|
|
||||||
/* Here's one of the main headaches. GetTileSlope does not correct for possibly
|
/* Here's one of the main headaches. GetTileSlope does not correct for possibly
|
||||||
* existing foundataions, so we do have to do that manually later on.*/
|
* existing foundataions, so we do have to do that manually later on.*/
|
||||||
|
@ -794,7 +794,7 @@ static CommandCost DoClearBridge(TileIndex tile, DoCommandFlag flags)
|
|||||||
/* read this value before actual removal of bridge */
|
/* read this value before actual removal of bridge */
|
||||||
bool rail = GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL;
|
bool rail = GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL;
|
||||||
Owner owner = GetTileOwner(tile);
|
Owner owner = GetTileOwner(tile);
|
||||||
uint height = GetBridgeHeight(tile);
|
int height = GetBridgeHeight(tile);
|
||||||
Train *v = NULL;
|
Train *v = NULL;
|
||||||
|
|
||||||
if (rail && HasTunnelBridgeReservation(tile)) {
|
if (rail && HasTunnelBridgeReservation(tile)) {
|
||||||
@ -807,7 +807,7 @@ static CommandCost DoClearBridge(TileIndex tile, DoCommandFlag flags)
|
|||||||
for (TileIndex c = tile + delta; c != endtile; c += delta) {
|
for (TileIndex c = tile + delta; c != endtile; c += delta) {
|
||||||
/* do not let trees appear from 'nowhere' after removing bridge */
|
/* do not let trees appear from 'nowhere' after removing bridge */
|
||||||
if (IsNormalRoadTile(c) && GetRoadside(c) == ROADSIDE_TREES) {
|
if (IsNormalRoadTile(c) && GetRoadside(c) == ROADSIDE_TREES) {
|
||||||
uint minz = GetTileMaxZ(c) + 3;
|
int minz = GetTileMaxZ(c) + 3;
|
||||||
if (height < minz) SetRoadside(c, ROADSIDE_PAVED);
|
if (height < minz) SetRoadside(c, ROADSIDE_PAVED);
|
||||||
}
|
}
|
||||||
ClearBridgeMiddle(c);
|
ClearBridgeMiddle(c);
|
||||||
@ -950,7 +950,7 @@ static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo *ti, Axis
|
|||||||
* @param overlay do we want to still see the road?
|
* @param overlay do we want to still see the road?
|
||||||
* @param head are we drawing bridge head?
|
* @param head are we drawing bridge head?
|
||||||
*/
|
*/
|
||||||
static void DrawBridgeTramBits(int x, int y, byte z, int offset, bool overlay, bool head)
|
static void DrawBridgeTramBits(int x, int y, int z, int offset, bool overlay, bool head)
|
||||||
{
|
{
|
||||||
static const SpriteID tram_offsets[2][6] = { { 107, 108, 109, 110, 111, 112 }, { 4, 5, 15, 16, 17, 18 } };
|
static const SpriteID tram_offsets[2][6] = { { 107, 108, 109, 110, 111, 112 }, { 4, 5, 15, 16, 17, 18 } };
|
||||||
static const SpriteID back_offsets[6] = { 95, 96, 99, 102, 100, 101 };
|
static const SpriteID back_offsets[6] = { 95, 96, 99, 102, 100, 101 };
|
||||||
|
@ -408,7 +408,7 @@ bool HasVehicleOnPos(TileIndex tile, void *data, VehicleFromPosProc *proc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Callback that returns 'real' vehicles lower or at height \c *(byte*)data .
|
* Callback that returns 'real' vehicles lower or at height \c *(int*)data .
|
||||||
* @param v Vehicle to examine.
|
* @param v Vehicle to examine.
|
||||||
* @param data Pointer to height data.
|
* @param data Pointer to height data.
|
||||||
* @return \a v if conditions are met, else \c NULL.
|
* @return \a v if conditions are met, else \c NULL.
|
||||||
|
@ -599,7 +599,7 @@ void OffsetGroundSprite(int x, int y)
|
|||||||
* @param z position z of the sprite.
|
* @param z position z of the sprite.
|
||||||
* @param sub Only draw a part of the sprite.
|
* @param sub Only draw a part of the sprite.
|
||||||
*/
|
*/
|
||||||
static void AddCombinedSprite(SpriteID image, PaletteID pal, int x, int y, byte z, const SubSprite *sub)
|
static void AddCombinedSprite(SpriteID image, PaletteID pal, int x, int y, int z, const SubSprite *sub)
|
||||||
{
|
{
|
||||||
Point pt = RemapCoords(x, y, z);
|
Point pt = RemapCoords(x, y, z);
|
||||||
const Sprite *spr = GetSprite(image & SPRITE_MASK, ST_NORMAL);
|
const Sprite *spr = GetSprite(image & SPRITE_MASK, ST_NORMAL);
|
||||||
@ -984,7 +984,7 @@ draw_inner:
|
|||||||
if (!is_redsq) DrawTileSelectionRect(ti, _thd.make_square_red ? PALETTE_SEL_TILE_RED : PAL_NONE);
|
if (!is_redsq) DrawTileSelectionRect(ti, _thd.make_square_red ? PALETTE_SEL_TILE_RED : PAL_NONE);
|
||||||
} else if (_thd.drawstyle & HT_POINT) {
|
} else if (_thd.drawstyle & HT_POINT) {
|
||||||
/* Figure out the Z coordinate for the single dot. */
|
/* Figure out the Z coordinate for the single dot. */
|
||||||
byte z = 0;
|
int z = 0;
|
||||||
FoundationPart foundation_part = FOUNDATION_PART_NORMAL;
|
FoundationPart foundation_part = FOUNDATION_PART_NORMAL;
|
||||||
if (ti->tileh & SLOPE_N) {
|
if (ti->tileh & SLOPE_N) {
|
||||||
z += TILE_HEIGHT;
|
z += TILE_HEIGHT;
|
||||||
|
Loading…
Reference in New Issue
Block a user