mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-11 18:10:14 +00:00
(svn r23107) -Codechange: let GetSlopePixelZ and TerraformTile tile type functions use int z as well
This commit is contained in:
parent
19eabdba2c
commit
459c9523e8
@ -107,7 +107,7 @@ static void DrawTile_Clear(TileInfo *ti)
|
||||
DrawBridgeMiddle(ti);
|
||||
}
|
||||
|
||||
static uint GetSlopePixelZ_Clear(TileIndex tile, uint x, uint y)
|
||||
static int GetSlopePixelZ_Clear(TileIndex tile, uint x, uint y)
|
||||
{
|
||||
int z;
|
||||
Slope tileh = GetTilePixelSlope(tile, &z);
|
||||
@ -361,7 +361,7 @@ static void ChangeTileOwner_Clear(TileIndex tile, Owner old_owner, Owner new_own
|
||||
return;
|
||||
}
|
||||
|
||||
static CommandCost TerraformTile_Clear(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
|
||||
static CommandCost TerraformTile_Clear(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
|
||||
{
|
||||
return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
||||
}
|
||||
|
@ -364,7 +364,7 @@ static void DrawTile_Industry(TileInfo *ti)
|
||||
}
|
||||
}
|
||||
|
||||
static uint GetSlopePixelZ_Industry(TileIndex tile, uint x, uint y)
|
||||
static int GetSlopePixelZ_Industry(TileIndex tile, uint x, uint y)
|
||||
{
|
||||
return GetTileMaxPixelZ(tile);
|
||||
}
|
||||
@ -2715,7 +2715,7 @@ bool IndustrySpec::UsesSmoothEconomy() const
|
||||
!(HasBit(this->callback_mask, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(this->callback_mask, CBM_IND_PRODUCTION_CHANGE)); // production change callbacks
|
||||
}
|
||||
|
||||
static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
|
||||
static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
|
||||
{
|
||||
if (AutoslopeEnabled()) {
|
||||
/* We imitate here TTDP's behaviour:
|
||||
|
@ -381,7 +381,7 @@ static void DrawTile_Object(TileInfo *ti)
|
||||
if (spec->flags & OBJECT_FLAG_ALLOW_UNDER_BRIDGE) DrawBridgeMiddle(ti);
|
||||
}
|
||||
|
||||
static uint GetSlopePixelZ_Object(TileIndex tile, uint x, uint y)
|
||||
static int GetSlopePixelZ_Object(TileIndex tile, uint x, uint y)
|
||||
{
|
||||
if (IsOwnedLand(tile)) {
|
||||
int z;
|
||||
@ -716,7 +716,7 @@ static void ChangeTileOwner_Object(TileIndex tile, Owner old_owner, Owner new_ow
|
||||
}
|
||||
}
|
||||
|
||||
static CommandCost TerraformTile_Object(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
|
||||
static CommandCost TerraformTile_Object(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
|
||||
{
|
||||
ObjectType type = GetObjectType(tile);
|
||||
|
||||
|
@ -2335,7 +2335,7 @@ void DrawTrainDepotSprite(int x, int y, int dir, RailType railtype)
|
||||
DrawRailTileSeqInGUI(x, y, dts, offset, 0, palette);
|
||||
}
|
||||
|
||||
static uint GetSlopePixelZ_Track(TileIndex tile, uint x, uint y)
|
||||
static int GetSlopePixelZ_Track(TileIndex tile, uint x, uint y)
|
||||
{
|
||||
if (IsPlainRail(tile)) {
|
||||
int z;
|
||||
@ -2826,7 +2826,7 @@ static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, uint z_ol
|
||||
return cost;
|
||||
}
|
||||
|
||||
static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
|
||||
static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
|
||||
{
|
||||
int z_old;
|
||||
Slope tileh_old = GetTileSlope(tile, &z_old);
|
||||
|
@ -1337,7 +1337,7 @@ void UpdateNearestTownForRoadTiles(bool invalidate)
|
||||
}
|
||||
}
|
||||
|
||||
static uint GetSlopePixelZ_Road(TileIndex tile, uint x, uint y)
|
||||
static int GetSlopePixelZ_Road(TileIndex tile, uint x, uint y)
|
||||
{
|
||||
|
||||
if (IsNormalRoad(tile)) {
|
||||
@ -1677,7 +1677,7 @@ static void ChangeTileOwner_Road(TileIndex tile, Owner old_owner, Owner new_owne
|
||||
}
|
||||
}
|
||||
|
||||
static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
|
||||
static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
|
||||
{
|
||||
if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) {
|
||||
switch (GetRoadTileType(tile)) {
|
||||
|
@ -2756,7 +2756,7 @@ void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, Ro
|
||||
DrawRailTileSeqInGUI(x, y, t, st == STATION_WAYPOINT ? 0 : total_offset, 0, pal);
|
||||
}
|
||||
|
||||
static uint GetSlopePixelZ_Station(TileIndex tile, uint x, uint y)
|
||||
static int GetSlopePixelZ_Station(TileIndex tile, uint x, uint y)
|
||||
{
|
||||
return GetTileMaxPixelZ(tile);
|
||||
}
|
||||
@ -3589,7 +3589,7 @@ CommandCost ClearTile_Station(TileIndex tile, DoCommandFlag flags)
|
||||
return CMD_ERROR;
|
||||
}
|
||||
|
||||
static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
|
||||
static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
|
||||
{
|
||||
if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) {
|
||||
/* TODO: If you implement newgrf callback 149 'land slope check', you have to decide what to do with it here.
|
||||
|
@ -70,7 +70,7 @@ struct TileDesc {
|
||||
* @param ti Information about the tile to draw
|
||||
*/
|
||||
typedef void DrawTileProc(TileInfo *ti);
|
||||
typedef uint GetSlopeZProc(TileIndex tile, uint x, uint y);
|
||||
typedef int GetSlopeZProc(TileIndex tile, uint x, uint y);
|
||||
typedef CommandCost ClearTileProc(TileIndex tile, DoCommandFlag flags);
|
||||
|
||||
/**
|
||||
@ -133,7 +133,7 @@ typedef Foundation GetFoundationProc(TileIndex tile, Slope tileh);
|
||||
* @param tileh_new Slope after terraforming.
|
||||
* @return Error code or extra cost for terraforming (like clearing land, building foundations, etc., but not the terraforming itself.)
|
||||
*/
|
||||
typedef CommandCost TerraformTileProc(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new);
|
||||
typedef CommandCost TerraformTileProc(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new);
|
||||
|
||||
/**
|
||||
* Set of callback functions for performing tile operations of a given tile type.
|
||||
|
@ -255,7 +255,7 @@ static void DrawTile_Town(TileInfo *ti)
|
||||
}
|
||||
}
|
||||
|
||||
static uint GetSlopePixelZ_Town(TileIndex tile, uint x, uint y)
|
||||
static int GetSlopePixelZ_Town(TileIndex tile, uint x, uint y)
|
||||
{
|
||||
return GetTileMaxPixelZ(tile);
|
||||
}
|
||||
@ -3046,7 +3046,7 @@ void TownsYearlyLoop()
|
||||
}
|
||||
}
|
||||
|
||||
static CommandCost TerraformTile_Town(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
|
||||
static CommandCost TerraformTile_Town(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
|
||||
{
|
||||
if (AutoslopeEnabled()) {
|
||||
HouseID house = GetHouseType(tile);
|
||||
|
@ -516,7 +516,7 @@ static void DrawTile_Trees(TileInfo *ti)
|
||||
}
|
||||
|
||||
|
||||
static uint GetSlopePixelZ_Trees(TileIndex tile, uint x, uint y)
|
||||
static int GetSlopePixelZ_Trees(TileIndex tile, uint x, uint y)
|
||||
{
|
||||
int z;
|
||||
Slope tileh = GetTilePixelSlope(tile, &z);
|
||||
@ -776,7 +776,7 @@ void InitializeTrees()
|
||||
_trees_tick_ctr = 0;
|
||||
}
|
||||
|
||||
static CommandCost TerraformTile_Trees(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
|
||||
static CommandCost TerraformTile_Trees(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
|
||||
{
|
||||
return DoCommand(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
|
||||
}
|
||||
|
@ -1359,7 +1359,7 @@ void DrawBridgeMiddle(const TileInfo *ti)
|
||||
}
|
||||
|
||||
|
||||
static uint GetSlopePixelZ_TunnelBridge(TileIndex tile, uint x, uint y)
|
||||
static int GetSlopePixelZ_TunnelBridge(TileIndex tile, uint x, uint y)
|
||||
{
|
||||
int z;
|
||||
Slope tileh = GetTilePixelSlope(tile, &z);
|
||||
@ -1673,7 +1673,7 @@ static VehicleEnterTileStatus VehicleEnter_TunnelBridge(Vehicle *v, TileIndex ti
|
||||
return VETSB_CONTINUE;
|
||||
}
|
||||
|
||||
static CommandCost TerraformTile_TunnelBridge(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
|
||||
static CommandCost TerraformTile_TunnelBridge(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
|
||||
{
|
||||
if (_settings_game.construction.build_on_slopes && AutoslopeEnabled() && IsBridge(tile) && GetTunnelBridgeTransportType(tile) != TRANSPORT_WATER) {
|
||||
DiagDirection direction = GetTunnelBridgeDirection(tile);
|
||||
@ -1685,10 +1685,10 @@ static CommandCost TerraformTile_TunnelBridge(TileIndex tile, DoCommandFlag flag
|
||||
/* Check if new slope is valid for bridges in general (so we can safely call GetBridgeFoundation()) */
|
||||
if ((direction == DIAGDIR_NW) || (direction == DIAGDIR_NE)) {
|
||||
CheckBridgeSlopeSouth(axis, &tileh_old, &z_old);
|
||||
res = CheckBridgeSlopeSouth(axis, &tileh_new, (int*)&z_new);
|
||||
res = CheckBridgeSlopeSouth(axis, &tileh_new, &z_new);
|
||||
} else {
|
||||
CheckBridgeSlopeNorth(axis, &tileh_old, &z_old);
|
||||
res = CheckBridgeSlopeNorth(axis, &tileh_new, (int*)&z_new);
|
||||
res = CheckBridgeSlopeNorth(axis, &tileh_new, &z_new);
|
||||
}
|
||||
|
||||
/* Surface slope is valid and remains unchanged? */
|
||||
|
@ -23,7 +23,7 @@ static void DrawTile_Void(TileInfo *ti)
|
||||
}
|
||||
|
||||
|
||||
static uint GetSlopePixelZ_Void(TileIndex tile, uint x, uint y)
|
||||
static int GetSlopePixelZ_Void(TileIndex tile, uint x, uint y)
|
||||
{
|
||||
return TilePixelHeight(tile);
|
||||
}
|
||||
@ -60,7 +60,7 @@ static TrackStatus GetTileTrackStatus_Void(TileIndex tile, TransportType mode, u
|
||||
return 0;
|
||||
}
|
||||
|
||||
static CommandCost TerraformTile_Void(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
|
||||
static CommandCost TerraformTile_Void(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
|
||||
{
|
||||
return_cmd_error(STR_ERROR_OFF_EDGE_OF_MAP);
|
||||
}
|
||||
|
@ -794,7 +794,7 @@ void DrawShipDepotSprite(int x, int y, Axis axis, DepotPart part)
|
||||
}
|
||||
|
||||
|
||||
static uint GetSlopePixelZ_Water(TileIndex tile, uint x, uint y)
|
||||
static int GetSlopePixelZ_Water(TileIndex tile, uint x, uint y)
|
||||
{
|
||||
int z;
|
||||
Slope tileh = GetTilePixelSlope(tile, &z);
|
||||
@ -1202,7 +1202,7 @@ static VehicleEnterTileStatus VehicleEnter_Water(Vehicle *v, TileIndex tile, int
|
||||
return VETSB_CONTINUE;
|
||||
}
|
||||
|
||||
static CommandCost TerraformTile_Water(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
|
||||
static CommandCost TerraformTile_Water(TileIndex tile, DoCommandFlag flags, int z_new, Slope tileh_new)
|
||||
{
|
||||
/* Canals can't be terraformed */
|
||||
if (IsWaterTile(tile) && IsCanal(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_CANAL_FIRST);
|
||||
|
Loading…
Reference in New Issue
Block a user