(svn r23091) -Codechange: rename some Get*Z functions to Get*PixelZ functions if they return the Z in pixels (like TilePixelHeight)
This commit is contained in:
@@ -306,8 +306,8 @@ static StringID GenerateStationName(Station *st, TileIndex tile, StationNaming n
|
||||
}
|
||||
|
||||
/* check elevation compared to town */
|
||||
uint z = GetTileZ(tile);
|
||||
uint z2 = GetTileZ(t->xy);
|
||||
uint z = GetTilePixelZ(tile);
|
||||
uint z2 = GetTilePixelZ(t->xy);
|
||||
if (z < z2) {
|
||||
if (HasBit(free_names, M(STR_SV_STNAME_VALLEY))) return STR_SV_STNAME_VALLEY;
|
||||
} else if (z > z2) {
|
||||
@@ -665,7 +665,7 @@ CommandCost CheckBuildableTile(TileIndex tile, uint invalid_dirs, int &allowed_z
|
||||
if (ret.Failed()) return ret;
|
||||
|
||||
uint z;
|
||||
Slope tileh = GetTileSlope(tile, &z);
|
||||
Slope tileh = GetTilePixelSlope(tile, &z);
|
||||
|
||||
/* Prohibit building if
|
||||
* 1) The tile is "steep" (i.e. stretches two height levels).
|
||||
@@ -677,7 +677,7 @@ CommandCost CheckBuildableTile(TileIndex tile, uint invalid_dirs, int &allowed_z
|
||||
}
|
||||
|
||||
CommandCost cost(EXPENSES_CONSTRUCTION);
|
||||
int flat_z = z + GetSlopeMaxZ(tileh);
|
||||
int flat_z = z + GetSlopeMaxPixelZ(tileh);
|
||||
if (tileh != SLOPE_FLAT) {
|
||||
/* Forbid building if the tile faces a slope in a invalid direction. */
|
||||
for (DiagDirection dir = DIAGDIR_BEGIN; dir != DIAGDIR_END; dir++) {
|
||||
@@ -2347,7 +2347,7 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
|
||||
if (distant_join && (!_settings_game.station.distant_join_stations || !Station::IsValidID(station_to_join))) return CMD_ERROR;
|
||||
|
||||
DiagDirection direction = GetInclinedSlopeDirection(GetTileSlope(tile, NULL));
|
||||
DiagDirection direction = GetInclinedSlopeDirection(GetTilePixelSlope(tile, NULL));
|
||||
if (direction == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
|
||||
direction = ReverseDiagDir(direction);
|
||||
|
||||
@@ -2364,7 +2364,7 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
|
||||
TileIndex tile_cur = tile + TileOffsByDiagDir(direction);
|
||||
|
||||
if (!IsTileType(tile_cur, MP_WATER) || GetTileSlope(tile_cur, NULL) != SLOPE_FLAT) {
|
||||
if (!IsTileType(tile_cur, MP_WATER) || GetTilePixelSlope(tile_cur, NULL) != SLOPE_FLAT) {
|
||||
return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
|
||||
}
|
||||
|
||||
@@ -2377,7 +2377,7 @@ CommandCost CmdBuildDock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
||||
if (ret.Failed()) return ret;
|
||||
|
||||
tile_cur += TileOffsByDiagDir(direction);
|
||||
if (!IsTileType(tile_cur, MP_WATER) || GetTileSlope(tile_cur, NULL) != SLOPE_FLAT) {
|
||||
if (!IsTileType(tile_cur, MP_WATER) || GetTilePixelSlope(tile_cur, NULL) != SLOPE_FLAT) {
|
||||
return_cmd_error(STR_ERROR_SITE_UNSUITABLE);
|
||||
}
|
||||
|
||||
@@ -2585,7 +2585,7 @@ static void DrawTile_Station(TileInfo *ti)
|
||||
* Check whether the foundation continues beyond the tile's upper sides. */
|
||||
uint edge_info = 0;
|
||||
uint z;
|
||||
Slope slope = GetFoundationSlope(ti->tile, &z);
|
||||
Slope slope = GetFoundationPixelSlope(ti->tile, &z);
|
||||
if (!HasFoundationNW(ti->tile, slope, z)) SetBit(edge_info, 0);
|
||||
if (!HasFoundationNE(ti->tile, slope, z)) SetBit(edge_info, 1);
|
||||
SpriteID image = GetCustomStationFoundationRelocation(statspec, st, ti->tile, tile_layout, edge_info);
|
||||
@@ -2641,7 +2641,7 @@ static void DrawTile_Station(TileInfo *ti)
|
||||
}
|
||||
|
||||
OffsetGroundSprite(31, 1);
|
||||
ti->z += ApplyFoundationToSlope(FOUNDATION_LEVELED, &ti->tileh);
|
||||
ti->z += ApplyPixelFoundationToSlope(FOUNDATION_LEVELED, &ti->tileh);
|
||||
} else {
|
||||
draw_default_foundation:
|
||||
DrawFoundation(ti, FOUNDATION_LEVELED);
|
||||
@@ -2756,9 +2756,9 @@ 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 GetSlopeZ_Station(TileIndex tile, uint x, uint y)
|
||||
static uint GetSlopePixelZ_Station(TileIndex tile, uint x, uint y)
|
||||
{
|
||||
return GetTileMaxZ(tile);
|
||||
return GetTileMaxPixelZ(tile);
|
||||
}
|
||||
|
||||
static Foundation GetFoundation_Station(TileIndex tile, Slope tileh)
|
||||
@@ -2898,7 +2898,7 @@ static void TileLoop_Station(TileIndex tile)
|
||||
break;
|
||||
|
||||
case STATION_DOCK:
|
||||
if (GetTileSlope(tile, NULL) != SLOPE_FLAT) break; // only handle water part
|
||||
if (GetTilePixelSlope(tile, NULL) != SLOPE_FLAT) break; // only handle water part
|
||||
/* FALL THROUGH */
|
||||
case STATION_OILRIG: //(station part)
|
||||
case STATION_BUOY:
|
||||
@@ -3595,7 +3595,7 @@ static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlag flags, ui
|
||||
/* TODO: If you implement newgrf callback 149 'land slope check', you have to decide what to do with it here.
|
||||
* TTDP does not call it.
|
||||
*/
|
||||
if (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new)) {
|
||||
if (GetTileMaxPixelZ(tile) == z_new + GetSlopeMaxPixelZ(tileh_new)) {
|
||||
switch (GetStationType(tile)) {
|
||||
case STATION_WAYPOINT:
|
||||
case STATION_RAIL: {
|
||||
@@ -3628,7 +3628,7 @@ static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlag flags, ui
|
||||
|
||||
extern const TileTypeProcs _tile_type_station_procs = {
|
||||
DrawTile_Station, // draw_tile_proc
|
||||
GetSlopeZ_Station, // get_slope_z_proc
|
||||
GetSlopePixelZ_Station, // get_slope_z_proc
|
||||
ClearTile_Station, // clear_tile_proc
|
||||
NULL, // add_accepted_cargo_proc
|
||||
GetTileDesc_Station, // get_tile_desc_proc
|
||||
|
Reference in New Issue
Block a user