diff --git a/src/ai/api/ai_tile.cpp b/src/ai/api/ai_tile.cpp index 98701b3a0e..2c098e5ba9 100644 --- a/src/ai/api/ai_tile.cpp +++ b/src/ai/api/ai_tile.cpp @@ -142,7 +142,7 @@ { if (!::IsValidTile(tile)) return SLOPE_INVALID; - return (Slope)::GetTileSlope(tile, NULL); + return (Slope)::GetTilePixelSlope(tile, NULL); } /* static */ AITile::Slope AITile::GetComplementSlope(Slope slope) @@ -156,14 +156,14 @@ { if (!::IsValidTile(tile)) return -1; - return ::GetTileZ(tile) / ::TILE_HEIGHT; + return ::GetTilePixelZ(tile) / ::TILE_HEIGHT; } /* static */ int32 AITile::GetMaxHeight(TileIndex tile) { if (!::IsValidTile(tile)) return -1; - return ::GetTileMaxZ(tile) / ::TILE_HEIGHT; + return ::GetTileMaxPixelZ(tile) / ::TILE_HEIGHT; } /* static */ int32 AITile::GetCornerHeight(TileIndex tile, Corner corner) @@ -171,8 +171,8 @@ if (!::IsValidTile(tile) || !::IsValidCorner((::Corner)corner)) return -1; uint z; - ::Slope slope = ::GetTileSlope(tile, &z); - return (z + ::GetSlopeZInCorner(slope, (::Corner)corner)) / ::TILE_HEIGHT; + ::Slope slope = ::GetTilePixelSlope(tile, &z); + return (z + ::GetSlopePixelZInCorner(slope, (::Corner)corner)) / ::TILE_HEIGHT; } /* static */ AICompany::CompanyID AITile::GetOwner(TileIndex tile) diff --git a/src/ai/api/ai_tunnel.cpp b/src/ai/api/ai_tunnel.cpp index 99aec30c4a..d82d8d68e6 100644 --- a/src/ai/api/ai_tunnel.cpp +++ b/src/ai/api/ai_tunnel.cpp @@ -30,7 +30,7 @@ if (IsTunnelTile(tile)) return ::GetOtherTunnelEnd(tile); uint start_z; - Slope start_tileh = ::GetTileSlope(tile, &start_z); + Slope start_tileh = ::GetTilePixelSlope(tile, &start_z); DiagDirection direction = ::GetInclinedSlopeDirection(start_tileh); if (direction == INVALID_DIAGDIR) return INVALID_TILE; @@ -40,7 +40,7 @@ tile += delta; if (!::IsValidTile(tile)) return INVALID_TILE; - ::GetTileSlope(tile, &end_z); + ::GetTilePixelSlope(tile, &end_z); } while (start_z != end_z); return tile; diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp index ab441dc3ea..50793cb1a5 100644 --- a/src/aircraft_cmd.cpp +++ b/src/aircraft_cmd.cpp @@ -251,7 +251,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine * v->x_pos = u->x_pos = x; v->y_pos = u->y_pos = y; - u->z_pos = GetSlopeZ(x, y); + u->z_pos = GetSlopePixelZ(x, y); v->z_pos = u->z_pos + 1; v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL; @@ -486,10 +486,10 @@ void SetAircraftPosition(Aircraft *v, int x, int y, int z) int safe_x = Clamp(x, 0, MapMaxX() * TILE_SIZE); int safe_y = Clamp(y - 1, 0, MapMaxY() * TILE_SIZE); u->x_pos = x; - u->y_pos = y - ((v->z_pos - GetSlopeZ(safe_x, safe_y)) >> 3); + u->y_pos = y - ((v->z_pos - GetSlopePixelZ(safe_x, safe_y)) >> 3); safe_y = Clamp(u->y_pos, 0, MapMaxY() * TILE_SIZE); - u->z_pos = GetSlopeZ(safe_x, safe_y); + u->z_pos = GetSlopePixelZ(safe_x, safe_y); u->cur_image = v->cur_image; VehicleMove(u, true); @@ -805,7 +805,7 @@ static bool AircraftController(Aircraft *v) v->tile = tile; /* Find altitude of landing position. */ - int z = GetSlopeZ(x, y) + 1 + afc->delta_z; + int z = GetSlopePixelZ(x, y) + 1 + afc->delta_z; if (z == v->z_pos) { Vehicle *u = v->Next()->Next(); @@ -950,7 +950,7 @@ static bool AircraftController(Aircraft *v) continue; } - uint curz = GetSlopeZ(x + amd.x, y + amd.y) + 1; + uint curz = GetSlopePixelZ(x + amd.x, y + amd.y) + 1; /* We're not flying below our destination, right? */ assert(curz <= z); @@ -966,7 +966,7 @@ static bool AircraftController(Aircraft *v) /* We've landed. Decrease speed when we're reaching end of runway. */ if (amd.flag & AMED_BRAKE) { - uint curz = GetSlopeZ(x, y) + 1; + uint curz = GetSlopePixelZ(x, y) + 1; if (z > curz) { z--; @@ -993,7 +993,7 @@ static bool HandleCrashedAircraft(Aircraft *v) /* make aircraft crash down to the ground */ if (v->crashed_counter < 500 && st == NULL && ((v->crashed_counter % 3) == 0) ) { - uint z = GetSlopeZ(v->x_pos, v->y_pos); + uint z = GetSlopePixelZ(v->x_pos, v->y_pos); v->z_pos -= 1; if (v->z_pos == z) { v->crashed_counter = 500; diff --git a/src/autoslope.h b/src/autoslope.h index e9bfa140f3..845b5c7cc5 100644 --- a/src/autoslope.h +++ b/src/autoslope.h @@ -33,7 +33,7 @@ */ static inline bool AutoslopeCheckForEntranceEdge(TileIndex tile, uint z_new, Slope tileh_new, DiagDirection entrance) { - if (GetTileMaxZ(tile) != z_new + GetSlopeMaxZ(tileh_new)) return false; + if (GetTileMaxPixelZ(tile) != z_new + GetSlopeMaxPixelZ(tileh_new)) return false; return ((tileh_new == SLOPE_FLAT) || CanBuildDepotByTileh(entrance, tileh_new)); } diff --git a/src/bridge_map.cpp b/src/bridge_map.cpp index c89af44d5c..37f4166c3b 100644 --- a/src/bridge_map.cpp +++ b/src/bridge_map.cpp @@ -67,12 +67,12 @@ TileIndex GetOtherBridgeEnd(TileIndex tile) * @param tile the bridge ramp tile to get the bridge height from * @return the height of the bridge in pixels */ -uint GetBridgeHeight(TileIndex t) +uint GetBridgePixelHeight(TileIndex t) { uint h; - Slope tileh = GetTileSlope(t, &h); + Slope tileh = GetTilePixelSlope(t, &h); Foundation f = GetBridgeFoundation(tileh, DiagDirToAxis(GetTunnelBridgeDirection(t))); /* one height level extra for the ramp */ - return h + TILE_HEIGHT + ApplyFoundationToSlope(f, &tileh); + return h + TILE_HEIGHT + ApplyPixelFoundationToSlope(f, &tileh); } diff --git a/src/bridge_map.h b/src/bridge_map.h index 7298582818..3e4c558c1c 100644 --- a/src/bridge_map.h +++ b/src/bridge_map.h @@ -89,7 +89,7 @@ TileIndex GetNorthernBridgeEnd(TileIndex t); TileIndex GetSouthernBridgeEnd(TileIndex t); TileIndex GetOtherBridgeEnd(TileIndex t); -uint GetBridgeHeight(TileIndex tile); +uint GetBridgePixelHeight(TileIndex tile); /** * Remove the bridge over the given axis. diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp index 65c50771b9..3506ddbffd 100644 --- a/src/clear_cmd.cpp +++ b/src/clear_cmd.cpp @@ -67,7 +67,7 @@ void DrawClearLandFence(const TileInfo *ti) if (!fence_sw && !fence_se) return; - int z = GetSlopeZInCorner(ti->tileh, CORNER_S); + int z = GetSlopePixelZInCorner(ti->tileh, CORNER_S); if (fence_sw) { DrawGroundSpriteAt(_clear_land_fence_sprites[GetFenceSW(ti->tile) - 1] + _fence_mod_by_tileh_sw[ti->tileh], PAL_NONE, 0, 0, z); @@ -107,12 +107,12 @@ static void DrawTile_Clear(TileInfo *ti) DrawBridgeMiddle(ti); } -static uint GetSlopeZ_Clear(TileIndex tile, uint x, uint y) +static uint GetSlopePixelZ_Clear(TileIndex tile, uint x, uint y) { uint z; - Slope tileh = GetTileSlope(tile, &z); + Slope tileh = GetTilePixelSlope(tile, &z); - return z + GetPartialZ(x & 0xF, y & 0xF, tileh); + return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh); } static Foundation GetFoundation_Clear(TileIndex tile, Slope tileh) @@ -158,7 +158,7 @@ void TileLoopClearHelper(TileIndex tile) /** Convert to or from snowy tiles. */ static void TileLoopClearAlps(TileIndex tile) { - int k = GetTileZ(tile) - GetSnowLine() + TILE_HEIGHT; + int k = GetTilePixelZ(tile) - GetSnowLine() + TILE_HEIGHT; if (k < 0) { /* Below the snow line, do nothing if no snow. */ @@ -231,7 +231,7 @@ static void TileLoop_Clear(TileIndex tile) /* If the tile is at any edge flood it to prevent maps without water. */ if (_settings_game.construction.freeform_edges && DistanceFromEdge(tile) == 1) { uint z; - Slope slope = GetTileSlope(tile, &z); + Slope slope = GetTilePixelSlope(tile, &z); if (z == 0 && slope == SLOPE_FLAT) { DoFloodTile(tile); MarkTileDirtyByTile(tile); @@ -368,7 +368,7 @@ static CommandCost TerraformTile_Clear(TileIndex tile, DoCommandFlag flags, uint extern const TileTypeProcs _tile_type_clear_procs = { DrawTile_Clear, ///< draw_tile_proc - GetSlopeZ_Clear, ///< get_slope_z_proc + GetSlopePixelZ_Clear, ///< get_slope_z_proc ClearTile_Clear, ///< clear_tile_proc NULL, ///< add_accepted_cargo_proc GetTileDesc_Clear, ///< get_tile_desc_proc diff --git a/src/command.cpp b/src/command.cpp index 75c625518f..4b60351090 100644 --- a/src/command.cpp +++ b/src/command.cpp @@ -540,7 +540,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac * the server, when it has cost the local company * something. Furthermore in the editor there is no * concept of cost, so don't show it there either. */ - ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res.GetCost()); + ShowCostOrIncomeAnimation(x, y, GetSlopePixelZ(x, y), res.GetCost()); } if (!estimate_only && !only_sending && callback != NULL) { diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp index 155b7c9c23..df6764bc17 100644 --- a/src/disaster_cmd.cpp +++ b/src/disaster_cmd.cpp @@ -168,9 +168,9 @@ static void SetDisasterVehiclePos(DisasterVehicle *v, int x, int y, byte z) int safe_y = Clamp(y - 1, 0, MapMaxY() * TILE_SIZE); u->x_pos = x; - u->y_pos = y - 1 - (max(z - GetSlopeZ(safe_x, safe_y), 0U) >> 3); + u->y_pos = y - 1 - (max(z - GetSlopePixelZ(safe_x, safe_y), 0U) >> 3); safe_y = Clamp(u->y_pos, 0, MapMaxY() * TILE_SIZE); - u->z_pos = GetSlopeZ(safe_x, safe_y); + u->z_pos = GetSlopePixelZ(safe_x, safe_y); u->direction = v->direction; DisasterVehicleUpdateImage(u); @@ -249,7 +249,7 @@ static bool DisasterTick_Zeppeliner(DisasterVehicle *v) int x = v->x_pos; int y = v->y_pos; - byte z = GetSlopeZ(x, y); + byte z = GetSlopePixelZ(x, y); if (z < v->z_pos) z = v->z_pos - 1; SetDisasterVehiclePos(v, x, y, z); @@ -509,7 +509,7 @@ static bool DisasterTick_Big_Ufo(DisasterVehicle *v) return false; } - byte z = GetSlopeZ(v->x_pos, v->y_pos); + byte z = GetSlopePixelZ(v->x_pos, v->y_pos); if (z < v->z_pos) { SetDisasterVehiclePos(v, v->x_pos, v->y_pos, v->z_pos - 1); return true; diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index 4b6b0331a8..dc0d9619d1 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -60,7 +60,7 @@ void CcBuildCanal(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p static TileIndex GetOtherAqueductEnd(TileIndex tile_from, TileIndex *tile_to = NULL) { uint z; - DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile_from, &z)); + DiagDirection dir = GetInclinedSlopeDirection(GetTilePixelSlope(tile_from, &z)); /* If the direction isn't right, just return the next tile so the command * complains about the wrong slope instead of the ends not matching up. @@ -79,7 +79,7 @@ static TileIndex GetOtherAqueductEnd(TileIndex tile_from, TileIndex *tile_to = N if (length > max_length) break; - if (GetTileMaxZ(endtile) > z) { + if (GetTileMaxPixelZ(endtile) > z) { if (tile_to != NULL) *tile_to = endtile; break; } @@ -212,7 +212,7 @@ struct BuildDocksToolbarWindow : Window { CommandContainer cmdcont = { tile, _ctrl_pressed, p2, CMD_BUILD_DOCK | CMD_MSG(STR_ERROR_CAN_T_BUILD_DOCK_HERE), CcBuildDocks, "" }; /* Determine the watery part of the dock. */ - DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile, NULL)); + DiagDirection dir = GetInclinedSlopeDirection(GetTilePixelSlope(tile, NULL)); TileIndex tile_to = (dir != INVALID_DIAGDIR ? TileAddByDiagDir(tile, ReverseDiagDir(dir)) : tile); ShowSelectStationIfNeeded(cmdcont, TileArea(tile, tile_to)); @@ -276,7 +276,7 @@ struct BuildDocksToolbarWindow : Window { if (this->last_clicked_widget == DTW_BUILD_AQUEDUCT) { GetOtherAqueductEnd(tile_from, &tile_to); } else { - DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile_from, NULL)); + DiagDirection dir = GetInclinedSlopeDirection(GetTilePixelSlope(tile_from, NULL)); if (IsValidDiagDirection(dir)) { /* Locks and docks always select the tile "down" the slope. */ tile_to = TileAddByDiagDir(tile_from, ReverseDiagDir(dir)); diff --git a/src/effectvehicle.cpp b/src/effectvehicle.cpp index d9ba92c2d1..700fa86cd0 100644 --- a/src/effectvehicle.cpp +++ b/src/effectvehicle.cpp @@ -624,7 +624,7 @@ EffectVehicle *CreateEffectVehicleAbove(int x, int y, int z, EffectVehicleType t { int safe_x = Clamp(x, 0, MapMaxX() * TILE_SIZE); int safe_y = Clamp(y, 0, MapMaxY() * TILE_SIZE); - return CreateEffectVehicle(x, y, GetSlopeZ(safe_x, safe_y) + z, type); + return CreateEffectVehicle(x, y, GetSlopePixelZ(safe_x, safe_y) + z, type); } /** diff --git a/src/elrail.cpp b/src/elrail.cpp index 74d0e45a59..b85cfcadbd 100644 --- a/src/elrail.cpp +++ b/src/elrail.cpp @@ -216,16 +216,16 @@ static byte GetPCPElevation(TileIndex tile, DiagDirection PCPpos) * * This position can be outside of the tile, i.e. ?_pcp_offset == TILE_SIZE > TILE_SIZE - 1. * So we have to move it inside the tile, because if the neighboured tile has a foundation, - * that does not smoothly connect to the current tile, we will get a wrong elevation from GetSlopeZ(). + * that does not smoothly connect to the current tile, we will get a wrong elevation from GetSlopePixelZ(). * * When we move the position inside the tile, we will get a wrong elevation if we have a slope. * To catch all cases we round the Z position to the next (TILE_HEIGHT / 2). * This will return the correct elevation for slopes and will also detect non-continuous elevation on edges. * - * Also note that the result of GetSlopeZ() is very special on bridge-ramps. + * Also note that the result of GetSlopePixelZ() is very special on bridge-ramps. */ - byte z = GetSlopeZ(TileX(tile) * TILE_SIZE + min(x_pcp_offsets[PCPpos], TILE_SIZE - 1), TileY(tile) * TILE_SIZE + min(y_pcp_offsets[PCPpos], TILE_SIZE - 1)); + byte z = GetSlopePixelZ(TileX(tile) * TILE_SIZE + min(x_pcp_offsets[PCPpos], TILE_SIZE - 1), TileY(tile) * TILE_SIZE + min(y_pcp_offsets[PCPpos], TILE_SIZE - 1)); return (z + 2) & ~3; // this means z = (z + TILE_HEIGHT / 4) / (TILE_HEIGHT / 2) * (TILE_HEIGHT / 2); } @@ -255,7 +255,7 @@ void DrawCatenaryOnTunnel(const TileInfo *ti) AddSortableSpriteToDraw( wire_base + sss->image_offset, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset, BB_data[2] - sss->x_offset, BB_data[3] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset + 1, - GetTileZ(ti->tile) + sss->z_offset, + GetTilePixelZ(ti->tile) + sss->z_offset, IsTransparencySet(TO_CATENARY), BB_data[0] - sss->x_offset, BB_data[1] - sss->y_offset, BB_Z_SEPARATOR - sss->z_offset ); @@ -317,9 +317,9 @@ static void DrawCatenaryRailway(const TileInfo *ti) TileIndex neighbour = ti->tile + TileOffsByDiagDir(i); byte 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. GetTilePixelSlope does not correct for possibly * existing foundataions, so we do have to do that manually later on.*/ - tileh[TS_NEIGHBOUR] = GetTileSlope(neighbour, NULL); + tileh[TS_NEIGHBOUR] = GetTilePixelSlope(neighbour, NULL); trackconfig[TS_NEIGHBOUR] = GetRailTrackBitsUniversal(neighbour, NULL); wireconfig[TS_NEIGHBOUR] = MaskWireBits(neighbour, trackconfig[TS_NEIGHBOUR]); if (IsTunnelTile(neighbour) && i != GetTunnelBridgeDirection(neighbour)) wireconfig[TS_NEIGHBOUR] = trackconfig[TS_NEIGHBOUR] = TRACK_BIT_NONE; @@ -376,7 +376,7 @@ static void DrawCatenaryRailway(const TileInfo *ti) foundation = GetBridgeFoundation(tileh[TS_NEIGHBOUR], DiagDirToAxis(GetTunnelBridgeDirection(neighbour))); } - ApplyFoundationToSlope(foundation, &tileh[TS_NEIGHBOUR]); + ApplyPixelFoundationToSlope(foundation, &tileh[TS_NEIGHBOUR]); /* Half tile slopes coincide only with horizontal/vertical track. * Faking a flat slope results in the correct sprites on positions. */ @@ -401,9 +401,9 @@ static void DrawCatenaryRailway(const TileInfo *ti) if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile)) { Track bridgetrack = GetBridgeAxis(ti->tile) == AXIS_X ? TRACK_X : TRACK_Y; - uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile)); + uint height = GetBridgePixelHeight(GetNorthernBridgeEnd(ti->tile)); - if ((height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) && + if ((height <= GetTileMaxPixelZ(ti->tile) + TILE_HEIGHT) && (i == PCPpositions[bridgetrack][0] || i == PCPpositions[bridgetrack][1])) { SetBit(OverridePCP, i); } @@ -438,9 +438,9 @@ static void DrawCatenaryRailway(const TileInfo *ti) /* Don't draw a wire under a low bridge */ if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_CATENARY)) { - uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile)); + uint height = GetBridgePixelHeight(GetNorthernBridgeEnd(ti->tile)); - if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return; + if (height <= GetTileMaxPixelZ(ti->tile) + TILE_HEIGHT) return; } SpriteID wire_normal = GetWireBase(ti->tile); @@ -470,11 +470,11 @@ static void DrawCatenaryRailway(const TileInfo *ti) /* * The "wire"-sprite position is inside the tile, i.e. 0 <= sss->?_offset < TILE_SIZE. - * Therefore it is safe to use GetSlopeZ() for the elevation. - * Also note that the result of GetSlopeZ() is very special for bridge-ramps. + * Therefore it is safe to use GetSlopePixelZ() for the elevation. + * Also note that the result of GetSlopePixelZ() is very special for bridge-ramps. */ AddSortableSpriteToDraw(wire_base + sss->image_offset, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset, - sss->x_size, sss->y_size, sss->z_size, GetSlopeZ(ti->x + sss->x_offset, ti->y + sss->y_offset) + sss->z_offset, + sss->x_size, sss->y_size, sss->z_size, GetSlopePixelZ(ti->x + sss->x_offset, ti->y + sss->y_offset) + sss->z_offset, IsTransparencySet(TO_CATENARY)); } } @@ -510,7 +510,7 @@ void DrawCatenaryOnBridge(const TileInfo *ti) sss = &CatenarySpriteData[WIRE_X_FLAT_SW + (num % 2) + offset]; } - height = GetBridgeHeight(end); + height = GetBridgePixelHeight(end); SpriteID wire_base = GetWireBase(end, TCX_ON_BRIDGE); @@ -561,7 +561,7 @@ void DrawCatenary(const TileInfo *ti) AddSortableSpriteToDraw( wire_base + sss->image_offset, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset, sss->x_size, sss->y_size, sss->z_size, - GetTileMaxZ(ti->tile) + sss->z_offset, + GetTileMaxPixelZ(ti->tile) + sss->z_offset, IsTransparencySet(TO_CATENARY) ); return; diff --git a/src/ground_vehicle.hpp b/src/ground_vehicle.hpp index 547a4d7789..600082e210 100644 --- a/src/ground_vehicle.hpp +++ b/src/ground_vehicle.hpp @@ -134,7 +134,7 @@ struct GroundVehicle : public SpecializedVehicle { */ FORCEINLINE void UpdateZPositionAndInclination() { - this->z_pos = GetSlopeZ(this->x_pos, this->y_pos); + this->z_pos = GetSlopePixelZ(this->x_pos, this->y_pos); ClrBit(this->gv_flags, GVF_GOINGUP_BIT); ClrBit(this->gv_flags, GVF_GOINGDOWN_BIT); @@ -143,7 +143,7 @@ struct GroundVehicle : public SpecializedVehicle { * direction it is sloped, we get the 'z' at the center of * the tile (middle_z) and the edge of the tile (old_z), * which we then can compare. */ - byte middle_z = GetSlopeZ((this->x_pos & ~TILE_UNIT_MASK) | HALF_TILE_SIZE, (this->y_pos & ~TILE_UNIT_MASK) | HALF_TILE_SIZE); + byte middle_z = GetSlopePixelZ((this->x_pos & ~TILE_UNIT_MASK) | HALF_TILE_SIZE, (this->y_pos & ~TILE_UNIT_MASK) | HALF_TILE_SIZE); if (middle_z != this->z_pos) { SetBit(this->gv_flags, (middle_z > this->z_pos) ? GVF_GOINGUP_BIT : GVF_GOINGDOWN_BIT); @@ -198,9 +198,9 @@ struct GroundVehicle : public SpecializedVehicle { * depending on orientation of the slope and vehicle's direction */ if (HasBit(this->gv_flags, GVF_GOINGUP_BIT) || HasBit(this->gv_flags, GVF_GOINGDOWN_BIT)) { - if (T::From(this)->HasToUseGetSlopeZ()) { - /* In some cases, we have to use GetSlopeZ() */ - this->z_pos = GetSlopeZ(this->x_pos, this->y_pos); + if (T::From(this)->HasToUseGetSlopePixelZ()) { + /* In some cases, we have to use GetSlopePixelZ() */ + this->z_pos = GetSlopePixelZ(this->x_pos, this->y_pos); return; } /* DirToDiagDir() is a simple right shift */ @@ -220,7 +220,7 @@ struct GroundVehicle : public SpecializedVehicle { this->z_pos += HasBit(this->gv_flags, GVF_GOINGUP_BIT) ? d : -d; } - assert(this->z_pos == GetSlopeZ(this->x_pos, this->y_pos)); + assert(this->z_pos == GetSlopePixelZ(this->x_pos, this->y_pos)); } /** diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp index f60b6f1cd7..d60e3d6cb9 100644 --- a/src/industry_cmd.cpp +++ b/src/industry_cmd.cpp @@ -364,9 +364,9 @@ static void DrawTile_Industry(TileInfo *ti) } } -static uint GetSlopeZ_Industry(TileIndex tile, uint x, uint y) +static uint GetSlopePixelZ_Industry(TileIndex tile, uint x, uint y) { - return GetTileMaxZ(tile); + return GetTileMaxPixelZ(tile); } static Foundation GetFoundation_Industry(TileIndex tile, Slope tileh) @@ -698,7 +698,7 @@ static void CreateChimneySmoke(TileIndex tile) { uint x = TileX(tile) * TILE_SIZE; uint y = TileY(tile) * TILE_SIZE; - uint z = GetTileMaxZ(tile); + uint z = GetTileMaxPixelZ(tile); CreateEffectVehicle(x + 15, y + 14, z + 59, EV_CHIMNEY_SMOKE); } @@ -979,7 +979,7 @@ static void SetupFarmFieldFence(TileIndex tile, int size, byte type, Axis direct static void PlantFarmField(TileIndex tile, IndustryID industry) { if (_settings_game.game_creation.landscape == LT_ARCTIC) { - if (GetTileZ(tile) + TILE_HEIGHT * 2 >= GetSnowLine()) return; + if (GetTilePixelZ(tile) + TILE_HEIGHT * 2 >= GetSnowLine()) return; } /* determine field size */ @@ -1165,7 +1165,7 @@ static CommandCost CheckNewIndustry_NULL(TileIndex tile) static CommandCost CheckNewIndustry_Forest(TileIndex tile) { if (_settings_game.game_creation.landscape == LT_ARCTIC) { - if (GetTileZ(tile) < HighestSnowLine() + TILE_HEIGHT * 2U) { + if (GetTilePixelZ(tile) < HighestSnowLine() + TILE_HEIGHT * 2U) { return_cmd_error(STR_ERROR_FOREST_CAN_ONLY_BE_PLANTED); } } @@ -1209,7 +1209,7 @@ static CommandCost CheckNewIndustry_OilRig(TileIndex tile) static CommandCost CheckNewIndustry_Farm(TileIndex tile) { if (_settings_game.game_creation.landscape == LT_ARCTIC) { - if (GetTileZ(tile) + TILE_HEIGHT * 2 >= HighestSnowLine()) { + if (GetTilePixelZ(tile) + TILE_HEIGHT * 2 >= HighestSnowLine()) { return_cmd_error(STR_ERROR_SITE_UNSUITABLE); } } @@ -1262,7 +1262,7 @@ static CommandCost CheckNewIndustry_Lumbermill(TileIndex tile) */ static CommandCost CheckNewIndustry_BubbleGen(TileIndex tile) { - if (GetTileZ(tile) > TILE_HEIGHT * 4) { + if (GetTilePixelZ(tile) > TILE_HEIGHT * 4) { return_cmd_error(STR_ERROR_CAN_ONLY_BE_BUILT_IN_LOW_AREAS); } return CommandCost(); @@ -1359,7 +1359,7 @@ static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTil if (gfx == GFX_WATERTILE_SPECIALCHECK) { if (!IsTileType(cur_tile, MP_WATER) || - GetTileSlope(cur_tile, NULL) != SLOPE_FLAT) { + GetTilePixelSlope(cur_tile, NULL) != SLOPE_FLAT) { return_cmd_error(STR_ERROR_SITE_UNSUITABLE); } } else { @@ -1379,7 +1379,7 @@ static CommandCost CheckIfIndustryTilesAreFree(TileIndex tile, const IndustryTil CommandCost ret = PerformIndustryTileSlopeCheck(tile, cur_tile, its, type, gfx, itspec_index, initial_random_bits, founder, creation_type); if (ret.Failed()) return ret; } else { - Slope tileh = GetTileSlope(cur_tile, NULL); + Slope tileh = GetTilePixelSlope(cur_tile, NULL); refused_slope |= IsSlopeRefused(tileh, its->slopes_refused); } @@ -2724,9 +2724,9 @@ static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlag flags, u * - Allow autoslope by default. * - Disallow autoslope if callback succeeds and returns non-zero. */ - Slope tileh_old = GetTileSlope(tile, NULL); + Slope tileh_old = GetTilePixelSlope(tile, NULL); /* TileMaxZ must not be changed. Slopes must not be steep. */ - if (!IsSteepSlope(tileh_old) && !IsSteepSlope(tileh_new) && (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new))) { + if (!IsSteepSlope(tileh_old) && !IsSteepSlope(tileh_new) && (GetTileMaxPixelZ(tile) == z_new + GetSlopeMaxPixelZ(tileh_new))) { const IndustryGfx gfx = GetIndustryGfx(tile); const IndustryTileSpec *itspec = GetIndustryTileSpec(gfx); @@ -2746,7 +2746,7 @@ static CommandCost TerraformTile_Industry(TileIndex tile, DoCommandFlag flags, u extern const TileTypeProcs _tile_type_industry_procs = { DrawTile_Industry, // draw_tile_proc - GetSlopeZ_Industry, // get_slope_z_proc + GetSlopePixelZ_Industry, // get_slope_z_proc ClearTile_Industry, // clear_tile_proc AddAcceptedCargo_Industry, // add_accepted_cargo_proc GetTileDesc_Industry, // get_tile_desc_proc diff --git a/src/landscape.cpp b/src/landscape.cpp index ec4b9f7a65..1314b97459 100644 --- a/src/landscape.cpp +++ b/src/landscape.cpp @@ -94,7 +94,7 @@ static SnowLine *_snow_line = NULL; * @param s The #Slope to modify. * @return Increment to the tile Z coordinate. */ -uint ApplyFoundationToSlope(Foundation f, Slope *s) +uint ApplyPixelFoundationToSlope(Foundation f, Slope *s) { if (!IsFoundation(f)) return 0; @@ -147,24 +147,24 @@ uint ApplyFoundationToSlope(Foundation f, Slope *s) * @param corners slope to examine * @return height of given point of given slope */ -uint GetPartialZ(int x, int y, Slope corners) +uint GetPartialPixelZ(int x, int y, Slope corners) { if (IsHalftileSlope(corners)) { switch (GetHalftileSlopeCorner(corners)) { case CORNER_W: - if (x - y >= 0) return GetSlopeMaxZ(corners); + if (x - y >= 0) return GetSlopeMaxPixelZ(corners); break; case CORNER_S: - if (x - (y ^ 0xF) >= 0) return GetSlopeMaxZ(corners); + if (x - (y ^ 0xF) >= 0) return GetSlopeMaxPixelZ(corners); break; case CORNER_E: - if (y - x >= 0) return GetSlopeMaxZ(corners); + if (y - x >= 0) return GetSlopeMaxPixelZ(corners); break; case CORNER_N: - if ((y ^ 0xF) - x >= 0) return GetSlopeMaxZ(corners); + if ((y ^ 0xF) - x >= 0) return GetSlopeMaxPixelZ(corners); break; default: NOT_REACHED(); @@ -274,7 +274,7 @@ uint GetPartialZ(int x, int y, Slope corners) return z; } -uint GetSlopeZ(int x, int y) +uint GetSlopePixelZ(int x, int y) { TileIndex tile = TileVirtXY(x, y); @@ -290,7 +290,7 @@ uint GetSlopeZ(int x, int y) * @param corner The corner. * @return Z position of corner relative to TileZ. */ -int GetSlopeZInCorner(Slope tileh, Corner corner) +int GetSlopePixelZInCorner(Slope tileh, Corner corner) { assert(!IsHalftileSlope(tileh)); return ((tileh & SlopeWithOneCornerRaised(corner)) != 0 ? TILE_HEIGHT : 0) + (tileh == SteepSlope(corner) ? TILE_HEIGHT : 0); @@ -308,7 +308,7 @@ int GetSlopeZInCorner(Slope tileh, Corner corner) * @param z1 Gets incremented by the height of the first corner of the edge. (near corner wrt. the camera) * @param z2 Gets incremented by the height of the second corner of the edge. (far corner wrt. the camera) */ -void GetSlopeZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2) +void GetSlopePixelZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2) { static const Slope corners[4][4] = { /* corner | steep slope @@ -331,17 +331,17 @@ void GetSlopeZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2) /** * Get slope of a tile on top of a (possible) foundation - * If a tile does not have a foundation, the function returns the same as GetTileSlope. + * If a tile does not have a foundation, the function returns the same as GetTilePixelSlope. * * @param tile The tile of interest. * @param z returns the z of the foundation slope. (Can be NULL, if not needed) * @return The slope on top of the foundation. */ -Slope GetFoundationSlope(TileIndex tile, uint *z) +Slope GetFoundationPixelSlope(TileIndex tile, uint *z) { - Slope tileh = GetTileSlope(tile, z); + Slope tileh = GetTilePixelSlope(tile, z); Foundation f = _tile_type_procs[GetTileType(tile)]->get_foundation_proc(tile, tileh); - uint z_inc = ApplyFoundationToSlope(f, &tileh); + uint z_inc = ApplyPixelFoundationToSlope(f, &tileh); if (z != NULL) *z += z_inc; return tileh; } @@ -353,12 +353,12 @@ bool HasFoundationNW(TileIndex tile, Slope slope_here, uint z_here) int z_W_here = z_here; int z_N_here = z_here; - GetSlopeZOnEdge(slope_here, DIAGDIR_NW, &z_W_here, &z_N_here); + GetSlopePixelZOnEdge(slope_here, DIAGDIR_NW, &z_W_here, &z_N_here); - Slope slope = GetFoundationSlope(TILE_ADDXY(tile, 0, -1), &z); + Slope slope = GetFoundationPixelSlope(TILE_ADDXY(tile, 0, -1), &z); int z_W = z; int z_N = z; - GetSlopeZOnEdge(slope, DIAGDIR_SE, &z_W, &z_N); + GetSlopePixelZOnEdge(slope, DIAGDIR_SE, &z_W, &z_N); return (z_N_here > z_N) || (z_W_here > z_W); } @@ -370,12 +370,12 @@ bool HasFoundationNE(TileIndex tile, Slope slope_here, uint z_here) int z_E_here = z_here; int z_N_here = z_here; - GetSlopeZOnEdge(slope_here, DIAGDIR_NE, &z_E_here, &z_N_here); + GetSlopePixelZOnEdge(slope_here, DIAGDIR_NE, &z_E_here, &z_N_here); - Slope slope = GetFoundationSlope(TILE_ADDXY(tile, -1, 0), &z); + Slope slope = GetFoundationPixelSlope(TILE_ADDXY(tile, -1, 0), &z); int z_E = z; int z_N = z; - GetSlopeZOnEdge(slope, DIAGDIR_SW, &z_E, &z_N); + GetSlopePixelZOnEdge(slope, DIAGDIR_SW, &z_E, &z_N); return (z_N_here > z_N) || (z_E_here > z_E); } @@ -394,7 +394,7 @@ void DrawFoundation(TileInfo *ti, Foundation f) uint sprite_block = 0; uint z; - Slope slope = GetFoundationSlope(ti->tile, &z); + Slope slope = GetFoundationPixelSlope(ti->tile, &z); /* Select the needed block of foundations sprites * Block 0: Walls at NW and NE edge @@ -419,7 +419,7 @@ void DrawFoundation(TileInfo *ti, Foundation f) } Corner highest_corner = GetHighestSlopeCorner(ti->tileh); - ti->z += ApplyFoundationToSlope(f, &ti->tileh); + ti->z += ApplyPixelFoundationToSlope(f, &ti->tileh); if (IsInclinedFoundation(f)) { /* inclined foundation */ @@ -481,7 +481,7 @@ void DrawFoundation(TileInfo *ti, Foundation f) ); OffsetGroundSprite(31, 9); } - ti->z += ApplyFoundationToSlope(f, &ti->tileh); + ti->z += ApplyPixelFoundationToSlope(f, &ti->tileh); } } @@ -927,7 +927,7 @@ static void CreateDesertOrRainForest() static bool FindSpring(TileIndex tile, void *user_data) { uint referenceHeight; - Slope s = GetTileSlope(tile, &referenceHeight); + Slope s = GetTilePixelSlope(tile, &referenceHeight); if (s != SLOPE_FLAT || IsWaterTile(tile)) return false; /* In the tropics rivers start in the rainforest. */ @@ -938,7 +938,7 @@ static bool FindSpring(TileIndex tile, void *user_data) for (int dx = -1; dx <= 1; dx++) { for (int dy = -1; dy <= 1; dy++) { TileIndex t = TileAddWrap(tile, dx, dy); - if (t != INVALID_TILE && GetTileMaxZ(t) > referenceHeight) num++; + if (t != INVALID_TILE && GetTileMaxPixelZ(t) > referenceHeight) num++; } } @@ -948,7 +948,7 @@ static bool FindSpring(TileIndex tile, void *user_data) for (int dx = -16; dx <= 16; dx++) { for (int dy = -16; dy <= 16; dy++) { TileIndex t = TileAddWrap(tile, dx, dy); - if (t != INVALID_TILE && GetTileMaxZ(t) > referenceHeight + 2 * TILE_HEIGHT) return false; + if (t != INVALID_TILE && GetTileMaxPixelZ(t) > referenceHeight + 2 * TILE_HEIGHT) return false; } } @@ -964,7 +964,7 @@ static bool FindSpring(TileIndex tile, void *user_data) static bool MakeLake(TileIndex tile, void *user_data) { uint height = *(uint*)user_data; - if (!IsValidTile(tile) || TileHeight(tile) != height || GetTileSlope(tile, NULL) != SLOPE_FLAT) return false; + if (!IsValidTile(tile) || TileHeight(tile) != height || GetTilePixelSlope(tile, NULL) != SLOPE_FLAT) return false; if (_settings_game.game_creation.landscape == LT_TROPIC && GetTropicZone(tile) == TROPICZONE_DESERT) return false; for (DiagDirection d = DIAGDIR_BEGIN; d < DIAGDIR_END; d++) { @@ -990,8 +990,8 @@ static bool FlowsDown(TileIndex begin, TileIndex end) uint heightBegin; uint heightEnd; - Slope slopeBegin = GetTileSlope(begin, &heightBegin); - Slope slopeEnd = GetTileSlope(end, &heightEnd); + Slope slopeBegin = GetTilePixelSlope(begin, &heightBegin); + Slope slopeEnd = GetTilePixelSlope(end, &heightEnd); return heightEnd <= heightBegin && /* Slope either is inclined or flat; rivers don't support other slopes. */ @@ -1113,7 +1113,7 @@ static bool FlowRiver(bool *marks, TileIndex spring, TileIndex begin) queue.pop_front(); uint height2 = TileHeight(end); - if (GetTileSlope(end, NULL) == SLOPE_FLAT && (height2 < height || (height2 == height && IsWaterTile(end)))) { + if (GetTilePixelSlope(end, NULL) == SLOPE_FLAT && (height2 < height || (height2 == height && IsWaterTile(end)))) { found = true; break; } @@ -1140,7 +1140,7 @@ static bool FlowRiver(bool *marks, TileIndex spring, TileIndex begin) if (IsValidTile(lakeCenter) && /* A river, or lake, can only be built on flat slopes. */ - GetTileSlope(lakeCenter, NULL) == SLOPE_FLAT && + GetTilePixelSlope(lakeCenter, NULL) == SLOPE_FLAT && /* We want the lake to be built at the height of the river. */ TileHeight(begin) == TileHeight(lakeCenter) && /* We don't want the lake at the entry of the valley. */ diff --git a/src/landscape.h b/src/landscape.h index dedc4d135d..b70b0a39aa 100644 --- a/src/landscape.h +++ b/src/landscape.h @@ -35,11 +35,11 @@ byte HighestSnowLine(); byte LowestSnowLine(); void ClearSnowLine(); -uint GetPartialZ(int x, int y, Slope corners); -uint GetSlopeZ(int x, int y); -void GetSlopeZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2); -int GetSlopeZInCorner(Slope tileh, Corner corner); -Slope GetFoundationSlope(TileIndex tile, uint *z); +uint GetPartialPixelZ(int x, int y, Slope corners); +uint GetSlopePixelZ(int x, int y); +void GetSlopePixelZOnEdge(Slope tileh, DiagDirection edge, int *z1, int *z2); +int GetSlopePixelZInCorner(Slope tileh, Corner corner); +Slope GetFoundationPixelSlope(TileIndex tile, uint *z); /** * Map 3D world or tile coordinate to equivalent 2D coordinate as used in the viewports and smallmap. @@ -67,7 +67,7 @@ static inline Point RemapCoords(int x, int y, int z) */ static inline Point RemapCoords2(int x, int y) { - return RemapCoords(x, y, GetSlopeZ(x, y)); + return RemapCoords(x, y, GetSlopePixelZ(x, y)); } /** @@ -84,7 +84,7 @@ static inline Point InverseRemapCoords(int x, int y) return pt; } -uint ApplyFoundationToSlope(Foundation f, Slope *s); +uint ApplyPixelFoundationToSlope(Foundation f, Slope *s); void DrawFoundation(TileInfo *ti, Foundation f); bool HasFoundationNW(TileIndex tile, Slope slope_here, uint z_here); bool HasFoundationNE(TileIndex tile, Slope slope_here, uint z_here); diff --git a/src/misc_gui.cpp b/src/misc_gui.cpp index cd1ef3f1ee..2be271f613 100644 --- a/src/misc_gui.cpp +++ b/src/misc_gui.cpp @@ -221,7 +221,7 @@ public: snprintf(tmp, lengthof(tmp), "0x%.4X", tile); SetDParam(0, TileX(tile)); SetDParam(1, TileY(tile)); - SetDParam(2, GetTileZ(tile) / TILE_HEIGHT); + SetDParam(2, GetTilePixelZ(tile) / TILE_HEIGHT); SetDParamStr(3, tmp); GetString(this->landinfo_data[line_nr], STR_LAND_AREA_INFORMATION_LANDINFO_COORDS, lastof(this->landinfo_data[line_nr])); line_nr++; diff --git a/src/newgrf_canal.cpp b/src/newgrf_canal.cpp index d516684567..696b88eb34 100644 --- a/src/newgrf_canal.cpp +++ b/src/newgrf_canal.cpp @@ -48,7 +48,7 @@ static uint32 CanalGetVariable(const ResolverObject *object, byte variable, byte switch (variable) { /* Height of tile */ case 0x80: { - uint z = GetTileZ(tile) / TILE_HEIGHT; + uint z = GetTilePixelZ(tile) / TILE_HEIGHT; /* Return consistent height within locks */ if (IsTileType(tile, MP_WATER) && IsLock(tile) && GetLockPart(tile) == LOCK_PART_UPPER) z--; return z; diff --git a/src/newgrf_commons.cpp b/src/newgrf_commons.cpp index add37d43c9..0bea74a13a 100644 --- a/src/newgrf_commons.cpp +++ b/src/newgrf_commons.cpp @@ -380,7 +380,7 @@ uint32 GetTerrainType(TileIndex tile, TileContext context) case MP_TUNNELBRIDGE: if (context == TCX_ON_BRIDGE) { - has_snow = (GetBridgeHeight(tile) > GetSnowLine()); + has_snow = (GetBridgePixelHeight(tile) > GetSnowLine()); } else { /* During map generation the snowstate may not be valid yet, as the tileloop may not have run yet. */ if (_generating_world) goto genworld; // we do not care about foundations here @@ -393,13 +393,13 @@ uint32 GetTerrainType(TileIndex tile, TileContext context) case MP_INDUSTRY: case MP_OBJECT: /* These tiles usually have a levelling foundation. So use max Z */ - has_snow = (GetTileMaxZ(tile) > GetSnowLine()); + has_snow = (GetTileMaxPixelZ(tile) > GetSnowLine()); break; case MP_VOID: case MP_WATER: genworld: - has_snow = (GetTileZ(tile) > GetSnowLine()); + has_snow = (GetTilePixelZ(tile) > GetSnowLine()); break; default: NOT_REACHED(); @@ -448,7 +448,7 @@ uint32 GetNearbyTileInformation(TileIndex tile) if (IsTileType(tile, MP_TREES) && GetTreeGround(tile) == TREE_GROUND_SHORE) tile_type = MP_WATER; uint z; - Slope tileh = GetTileSlope(tile, &z); + Slope tileh = GetTilePixelSlope(tile, &z); /* Return 0 if the tile is a land tile */ byte terrain_type = (HasTileWaterClass(tile) ? (GetWaterClass(tile) + 1) & 3 : 0) << 5 | GetTerrainType(tile) << 2 | (tile_type == MP_WATER ? 1 : 0) << 1; return tile_type << 24 | z << 16 | terrain_type << 8 | tileh; diff --git a/src/newgrf_industries.cpp b/src/newgrf_industries.cpp index 71118b1261..4bc188bb12 100644 --- a/src/newgrf_industries.cpp +++ b/src/newgrf_industries.cpp @@ -488,7 +488,7 @@ uint32 IndustryLocationGetVariable(const ResolverObject *object, byte variable, case 0x89: return min(DistanceManhattan(industry->town->xy, tile), 255); /* Lowest height of the tile */ - case 0x8A: return GetTileZ(tile); + case 0x8A: return GetTilePixelZ(tile); /* Distance to the nearest water/land tile */ case 0x8B: return GetClosestWaterDistance(tile, (GetIndustrySpec(industry->type)->behaviour & INDUSTRYBEH_BUILT_ONWATER) == 0); diff --git a/src/newgrf_industrytiles.cpp b/src/newgrf_industrytiles.cpp index caecde957d..2a85779375 100644 --- a/src/newgrf_industrytiles.cpp +++ b/src/newgrf_industrytiles.cpp @@ -295,7 +295,7 @@ CommandCost PerformIndustryTileSlopeCheck(TileIndex ind_base_tile, TileIndex ind uint16 callback_res = GetIndustryTileCallback(CBID_INDTILE_SHAPE_CHECK, 0, creation_type << 8 | itspec_index, gfx, &ind, ind_tile); if (callback_res == CALLBACK_FAILED) { - if (!IsSlopeRefused(GetTileSlope(ind_tile, NULL), its->slopes_refused)) return CommandCost(); + if (!IsSlopeRefused(GetTilePixelSlope(ind_tile, NULL), its->slopes_refused)) return CommandCost(); return_cmd_error(STR_ERROR_SITE_UNSUITABLE); } if (its->grf_prop.grffile->grf_version < 7) { diff --git a/src/newgrf_object.cpp b/src/newgrf_object.cpp index a6b0c3eddf..a4807ea3ec 100644 --- a/src/newgrf_object.cpp +++ b/src/newgrf_object.cpp @@ -289,7 +289,7 @@ static uint32 ObjectGetVariable(const ResolverObject *object, byte variable, byt } /* Tile information. */ - case 0x41: return GetTileSlope(tile, NULL) << 8 | GetTerrainType(tile); + case 0x41: return GetTilePixelSlope(tile, NULL) << 8 | GetTerrainType(tile); /* Construction date */ case 0x42: return o->build_date; diff --git a/src/newgrf_station.cpp b/src/newgrf_station.cpp index b33259d321..13f996cc48 100644 --- a/src/newgrf_station.cpp +++ b/src/newgrf_station.cpp @@ -293,7 +293,7 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by if (object->u.station.axis != INVALID_AXIS && tile != INVALID_TILE) { if (parameter != 0) tile = GetNearbyTile(parameter, tile, true, object->u.station.axis); // only perform if it is required - Slope tileh = GetTileSlope(tile, NULL); + Slope tileh = GetTilePixelSlope(tile, NULL); bool swap = (object->u.station.axis == AXIS_Y && HasBit(tileh, CORNER_W) != HasBit(tileh, CORNER_E)); return GetNearbyTileInformation(tile) ^ (swap ? SLOPE_EW : 0); @@ -350,7 +350,7 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by if (parameter != 0) tile = GetNearbyTile(parameter, tile); // only perform if it is required - Slope tileh = GetTileSlope(tile, NULL); + Slope tileh = GetTilePixelSlope(tile, NULL); bool swap = (axis == AXIS_Y && HasBit(tileh, CORNER_W) != HasBit(tileh, CORNER_E)); return GetNearbyTileInformation(tile) ^ (swap ? SLOPE_EW : 0); @@ -678,7 +678,7 @@ uint16 GetStationCallback(CallbackID callback, uint32 param1, uint32 param2, con CommandCost PerformStationTileSlopeCheck(TileIndex north_tile, TileIndex cur_tile, const StationSpec *statspec, Axis axis, byte plat_len, byte numtracks) { TileIndexDiff diff = cur_tile - north_tile; - Slope slope = GetTileSlope(cur_tile, NULL); + Slope slope = GetTilePixelSlope(cur_tile, NULL); ResolverObject object; NewStationResolver(&object, statspec, NULL, cur_tile); diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp index 469f9fe060..bd36e48c91 100644 --- a/src/object_cmd.cpp +++ b/src/object_cmd.cpp @@ -230,13 +230,13 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 /* So, now the surface is checked... check the slope of said surface. */ int allowed_z; - if (GetTileSlope(tile, (uint*)&allowed_z) != SLOPE_FLAT) allowed_z += TILE_HEIGHT; + if (GetTilePixelSlope(tile, (uint*)&allowed_z) != SLOPE_FLAT) allowed_z += TILE_HEIGHT; TILE_AREA_LOOP(t, ta) { uint16 callback = CALLBACK_FAILED; if (HasBit(spec->callback_mask, CBM_OBJ_SLOPE_CHECK)) { TileIndex diff = t - tile; - callback = GetObjectCallback(CBID_OBJECT_LAND_SLOPE_CHECK, GetTileSlope(t, NULL), TileY(diff) << 4 | TileX(diff), spec, NULL, t, view); + callback = GetObjectCallback(CBID_OBJECT_LAND_SLOPE_CHECK, GetTilePixelSlope(t, NULL), TileY(diff) << 4 | TileX(diff), spec, NULL, t, view); } if (callback == CALLBACK_FAILED) { @@ -267,7 +267,7 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 TILE_AREA_LOOP(t, ta) { if (MayHaveBridgeAbove(t) && IsBridgeAbove(t) && ( !(spec->flags & OBJECT_FLAG_ALLOW_UNDER_BRIDGE) || - (GetTileMaxZ(t) + spec->height * TILE_HEIGHT >= GetBridgeHeight(GetSouthernBridgeEnd(t))))) { + (GetTileMaxPixelZ(t) + spec->height * TILE_HEIGHT >= GetBridgePixelHeight(GetSouthernBridgeEnd(t))))) { return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); } } @@ -276,7 +276,7 @@ CommandCost CmdBuildObject(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3 switch (type) { case OBJECT_TRANSMITTER: case OBJECT_LIGHTHOUSE: - if (GetTileSlope(tile, NULL) != SLOPE_FLAT) return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED); + if (GetTilePixelSlope(tile, NULL) != SLOPE_FLAT) return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED); break; case OBJECT_OWNED_LAND: @@ -381,15 +381,15 @@ static void DrawTile_Object(TileInfo *ti) if (spec->flags & OBJECT_FLAG_ALLOW_UNDER_BRIDGE) DrawBridgeMiddle(ti); } -static uint GetSlopeZ_Object(TileIndex tile, uint x, uint y) +static uint GetSlopePixelZ_Object(TileIndex tile, uint x, uint y) { if (IsOwnedLand(tile)) { uint z; - Slope tileh = GetTileSlope(tile, &z); + Slope tileh = GetTilePixelSlope(tile, &z); - return z + GetPartialZ(x & 0xF, y & 0xF, tileh); + return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh); } else { - return GetTileMaxZ(tile); + return GetTileMaxPixelZ(tile); } } @@ -643,7 +643,7 @@ void GenerateObjects() TileIndex tile = RandomTile(); uint h; - if (IsTileType(tile, MP_CLEAR) && GetTileSlope(tile, &h) == SLOPE_FLAT && h >= TILE_HEIGHT * 4 && !IsBridgeAbove(tile)) { + if (IsTileType(tile, MP_CLEAR) && GetTilePixelSlope(tile, &h) == SLOPE_FLAT && h >= TILE_HEIGHT * 4 && !IsBridgeAbove(tile)) { TileIndex t = tile; if (CircularTileSearch(&t, 9, HasTransmitter, NULL)) continue; @@ -680,7 +680,7 @@ void GenerateObjects() for (int j = 0; j < 19; j++) { uint h; - if (IsTileType(tile, MP_CLEAR) && GetTileSlope(tile, &h) == SLOPE_FLAT && h <= TILE_HEIGHT * 2 && !IsBridgeAbove(tile)) { + if (IsTileType(tile, MP_CLEAR) && GetTilePixelSlope(tile, &h) == SLOPE_FLAT && h <= TILE_HEIGHT * 2 && !IsBridgeAbove(tile)) { BuildObject(OBJECT_LIGHTHOUSE, tile); IncreaseGeneratingWorldProgress(GWP_OBJECT); lighthouses_to_build--; @@ -731,9 +731,9 @@ static CommandCost TerraformTile_Object(TileIndex tile, DoCommandFlag flags, uin * - Allow autoslope by default. * - Disallow autoslope if callback succeeds and returns non-zero. */ - Slope tileh_old = GetTileSlope(tile, NULL); + Slope tileh_old = GetTilePixelSlope(tile, NULL); /* TileMaxZ must not be changed. Slopes must not be steep. */ - if (!IsSteepSlope(tileh_old) && !IsSteepSlope(tileh_new) && (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new))) { + if (!IsSteepSlope(tileh_old) && !IsSteepSlope(tileh_new) && (GetTileMaxPixelZ(tile) == z_new + GetSlopeMaxPixelZ(tileh_new))) { const ObjectSpec *spec = ObjectSpec::Get(type); /* Call callback 'disable autosloping for objects'. */ @@ -753,7 +753,7 @@ static CommandCost TerraformTile_Object(TileIndex tile, DoCommandFlag flags, uin extern const TileTypeProcs _tile_type_object_procs = { DrawTile_Object, // draw_tile_proc - GetSlopeZ_Object, // get_slope_z_proc + GetSlopePixelZ_Object, // get_slope_z_proc ClearTile_Object, // clear_tile_proc AddAcceptedCargo_Object, // add_accepted_cargo_proc GetTileDesc_Object, // get_tile_desc_proc diff --git a/src/pathfinder/npf/npf.cpp b/src/pathfinder/npf/npf.cpp index 9eca606f06..bfefce2153 100644 --- a/src/pathfinder/npf/npf.cpp +++ b/src/pathfinder/npf/npf.cpp @@ -237,8 +237,8 @@ static uint NPFSlopeCost(AyStarNode *current) /* Get the height on both sides of the tile edge. * Avoid testing the height on the tile-center. This will fail for halftile-foundations. */ - int z1 = GetSlopeZ(x1 + dx4, y1 + dy4); - int z2 = GetSlopeZ(x2 - dx4, y2 - dy4); + int z1 = GetSlopePixelZ(x1 + dx4, y1 + dy4); + int z2 = GetSlopePixelZ(x2 - dx4, y2 - dy4); if (z2 - z1 > 1) { /* Slope up */ diff --git a/src/pathfinder/yapf/yapf_costbase.hpp b/src/pathfinder/yapf/yapf_costbase.hpp index 057c0ae5b1..6f6fed0072 100644 --- a/src/pathfinder/yapf/yapf_costbase.hpp +++ b/src/pathfinder/yapf/yapf_costbase.hpp @@ -27,13 +27,13 @@ struct CYapfCostBase { /* it is bridge ramp, check if we are entering the bridge */ if (GetTunnelBridgeDirection(tile) != TrackdirToExitdir(td)) return false; // no, we are leaving it, no penalty /* we are entering the bridge */ - Slope tile_slope = GetTileSlope(tile, NULL); + Slope tile_slope = GetTilePixelSlope(tile, NULL); Axis axis = DiagDirToAxis(GetTunnelBridgeDirection(tile)); return !HasBridgeFlatRamp(tile_slope, axis); } else { /* not bridge ramp */ if (IsTunnelTile(tile)) return false; // tunnel entry/exit doesn't slope - Slope tile_slope = GetTileSlope(tile, NULL); + Slope tile_slope = GetTilePixelSlope(tile, NULL); return IsUphillTrackdir(tile_slope, td); // slopes uphill => apply penalty } } diff --git a/src/pathfinder/yapf/yapf_road.cpp b/src/pathfinder/yapf/yapf_road.cpp index c909e7e8a4..9a0b40f5bf 100644 --- a/src/pathfinder/yapf/yapf_road.cpp +++ b/src/pathfinder/yapf/yapf_road.cpp @@ -36,12 +36,12 @@ protected: /* height of the center of the current tile */ int x1 = TileX(tile) * TILE_SIZE; int y1 = TileY(tile) * TILE_SIZE; - int z1 = GetSlopeZ(x1 + TILE_SIZE / 2, y1 + TILE_SIZE / 2); + int z1 = GetSlopePixelZ(x1 + TILE_SIZE / 2, y1 + TILE_SIZE / 2); /* height of the center of the next tile */ int x2 = TileX(next_tile) * TILE_SIZE; int y2 = TileY(next_tile) * TILE_SIZE; - int z2 = GetSlopeZ(x2 + TILE_SIZE / 2, y2 + TILE_SIZE / 2); + int z2 = GetSlopePixelZ(x2 + TILE_SIZE / 2, y2 + TILE_SIZE / 2); if (z2 - z1 > 1) { /* Slope up */ diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 35895c38a0..7ef04122e7 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -381,7 +381,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u if (!ValParamRailtype(railtype) || !ValParamTrackOrientation(track)) return CMD_ERROR; - Slope tileh = GetTileSlope(tile, NULL); + Slope tileh = GetTilePixelSlope(tile, NULL); TrackBits trackbit = TrackToTrackBits(track); switch (GetTileType(tile)) { @@ -590,7 +590,7 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, owner = GetTileOwner(tile); present ^= trackbit; if (present == 0) { - Slope tileh = GetTileSlope(tile, NULL); + Slope tileh = GetTilePixelSlope(tile, NULL); /* If there is flat water on the lower halftile, convert the tile to shore so the water remains */ if (GetRailGroundType(tile) == RAIL_GROUND_WATER && IsSlopeWithOneCornerRaised(tileh)) { MakeShore(tile); @@ -649,7 +649,7 @@ bool FloodHalftile(TileIndex t) bool flooded = false; if (GetRailGroundType(t) == RAIL_GROUND_WATER) return flooded; - Slope tileh = GetTileSlope(t, NULL); + Slope tileh = GetTilePixelSlope(t, NULL); TrackBits rail_bits = GetTrackBits(t); if (IsSlopeWithOneCornerRaised(tileh)) { @@ -676,7 +676,7 @@ bool FloodHalftile(TileIndex t) } } else { /* Make shore on steep slopes and 'three-corners-raised'-slopes. */ - if (ApplyFoundationToSlope(GetRailFoundation(tileh, rail_bits), &tileh) == 0) { + if (ApplyPixelFoundationToSlope(GetRailFoundation(tileh, rail_bits), &tileh) == 0) { if (IsSteepSlope(tileh) || IsSlopeWithThreeCornersRaised(tileh)) { flooded = true; SetRailGroundType(t, RAIL_GROUND_WATER); @@ -861,7 +861,7 @@ CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, u RailType railtype = Extract(p1); if (!ValParamRailtype(railtype)) return CMD_ERROR; - Slope tileh = GetTileSlope(tile, NULL); + Slope tileh = GetTilePixelSlope(tile, NULL); DiagDirection dir = Extract(p2); @@ -1637,7 +1637,7 @@ static CommandCost ClearTile_Track(TileIndex tile, DoCommandFlag flags) switch (GetRailTileType(tile)) { case RAIL_TILE_SIGNALS: case RAIL_TILE_NORMAL: { - Slope tileh = GetTileSlope(tile, NULL); + Slope tileh = GetTilePixelSlope(tile, NULL); /* Is there flat water on the lower halftile that gets cleared expensively? */ bool water_ground = (GetRailGroundType(tile) == RAIL_GROUND_WATER && IsSlopeWithOneCornerRaised(tileh)); @@ -1683,7 +1683,7 @@ static uint GetSaveSlopeZ(uint x, uint y, Track track) case TRACK_RIGHT: x &= ~0xF; y |= 0xF; break; default: break; } - return GetSlopeZ(x, y); + return GetSlopePixelZ(x, y); } static void DrawSingleSignal(TileIndex tile, Track track, byte condition, uint image, uint pos) @@ -1774,7 +1774,7 @@ static void DrawTrackFence_NE_SW(const TileInfo *ti, SpriteID base_image) */ static void DrawTrackFence_NS_1(const TileInfo *ti, SpriteID base_image) { - uint z = ti->z + GetSlopeZInCorner(RemoveHalftileSlope(ti->tileh), CORNER_W); + uint z = ti->z + GetSlopePixelZInCorner(RemoveHalftileSlope(ti->tileh), CORNER_W); AddSortableSpriteToDraw(base_image + RFO_FLAT_VERT, _drawtile_track_palette, ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2, 1, 1, 4, z); } @@ -1784,7 +1784,7 @@ static void DrawTrackFence_NS_1(const TileInfo *ti, SpriteID base_image) */ static void DrawTrackFence_NS_2(const TileInfo *ti, SpriteID base_image) { - uint z = ti->z + GetSlopeZInCorner(RemoveHalftileSlope(ti->tileh), CORNER_E); + uint z = ti->z + GetSlopePixelZInCorner(RemoveHalftileSlope(ti->tileh), CORNER_E); AddSortableSpriteToDraw(base_image + RFO_FLAT_VERT, _drawtile_track_palette, ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2, 1, 1, 4, z); } @@ -1794,7 +1794,7 @@ static void DrawTrackFence_NS_2(const TileInfo *ti, SpriteID base_image) */ static void DrawTrackFence_WE_1(const TileInfo *ti, SpriteID base_image) { - uint z = ti->z + GetSlopeZInCorner(RemoveHalftileSlope(ti->tileh), CORNER_N); + uint z = ti->z + GetSlopePixelZInCorner(RemoveHalftileSlope(ti->tileh), CORNER_N); AddSortableSpriteToDraw(base_image + RFO_FLAT_HORZ, _drawtile_track_palette, ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2, 1, 1, 4, z); } @@ -1804,7 +1804,7 @@ static void DrawTrackFence_WE_1(const TileInfo *ti, SpriteID base_image) */ static void DrawTrackFence_WE_2(const TileInfo *ti, SpriteID base_image) { - uint z = ti->z + GetSlopeZInCorner(RemoveHalftileSlope(ti->tileh), CORNER_S); + uint z = ti->z + GetSlopePixelZInCorner(RemoveHalftileSlope(ti->tileh), CORNER_S); AddSortableSpriteToDraw(base_image + RFO_FLAT_HORZ, _drawtile_track_palette, ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2, 1, 1, 4, z); } @@ -2335,17 +2335,17 @@ void DrawTrainDepotSprite(int x, int y, int dir, RailType railtype) DrawRailTileSeqInGUI(x, y, dts, offset, 0, palette); } -static uint GetSlopeZ_Track(TileIndex tile, uint x, uint y) +static uint GetSlopePixelZ_Track(TileIndex tile, uint x, uint y) { if (IsPlainRail(tile)) { uint z; - Slope tileh = GetTileSlope(tile, &z); + Slope tileh = GetTilePixelSlope(tile, &z); if (tileh == SLOPE_FLAT) return z; - z += ApplyFoundationToSlope(GetRailFoundation(tileh, GetTrackBits(tile)), &tileh); - return z + GetPartialZ(x & 0xF, y & 0xF, tileh); + z += ApplyPixelFoundationToSlope(GetRailFoundation(tileh, GetTrackBits(tile)), &tileh); + return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh); } else { - return GetTileMaxZ(tile); + return GetTileMaxPixelZ(tile); } } @@ -2367,7 +2367,7 @@ static void TileLoop_Track(TileIndex tile) switch (_settings_game.game_creation.landscape) { case LT_ARCTIC: { uint z; - Slope slope = GetTileSlope(tile, &z); + Slope slope = GetTilePixelSlope(tile, &z); bool half = false; /* for non-flat track, use lower part of track @@ -2795,8 +2795,8 @@ static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, uint z_ol if (CheckRailSlope(tileh_new, rail_bits, TRACK_BIT_NONE, tile).Failed()) return_cmd_error(STR_ERROR_MUST_REMOVE_RAILROAD_TRACK); /* Get the slopes on top of the foundations */ - z_old += ApplyFoundationToSlope(GetRailFoundation(tileh_old, rail_bits), &tileh_old); - z_new += ApplyFoundationToSlope(GetRailFoundation(tileh_new, rail_bits), &tileh_new); + z_old += ApplyPixelFoundationToSlope(GetRailFoundation(tileh_old, rail_bits), &tileh_old); + z_new += ApplyPixelFoundationToSlope(GetRailFoundation(tileh_new, rail_bits), &tileh_new); Corner track_corner; switch (rail_bits) { @@ -2812,8 +2812,8 @@ static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, uint z_ol } /* The height of the track_corner must not be changed. The rest ensures GetRailFoundation() already. */ - z_old += GetSlopeZInCorner(RemoveHalftileSlope(tileh_old), track_corner); - z_new += GetSlopeZInCorner(RemoveHalftileSlope(tileh_new), track_corner); + z_old += GetSlopePixelZInCorner(RemoveHalftileSlope(tileh_old), track_corner); + z_new += GetSlopePixelZInCorner(RemoveHalftileSlope(tileh_new), track_corner); if (z_old != z_new) return_cmd_error(STR_ERROR_MUST_REMOVE_RAILROAD_TRACK); CommandCost cost = CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]); @@ -2829,7 +2829,7 @@ static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, uint z_ol static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) { uint z_old; - Slope tileh_old = GetTileSlope(tile, &z_old); + Slope tileh_old = GetTilePixelSlope(tile, &z_old); if (IsPlainRail(tile)) { TrackBits rail_bits = GetTrackBits(tile); /* Is there flat water on the lower halftile that must be cleared expensively? */ @@ -2856,7 +2856,7 @@ static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, uint /* Everything is valid, which only changes allowed_corner */ for (Corner corner = (Corner)0; corner < CORNER_END; corner = (Corner)(corner + 1)) { if (allowed_corner == corner) continue; - if (z_old + GetSlopeZInCorner(tileh_old, corner) != z_new + GetSlopeZInCorner(tileh_new, corner)) return autoslope_result; + if (z_old + GetSlopePixelZInCorner(tileh_old, corner) != z_new + GetSlopePixelZInCorner(tileh_new, corner)) return autoslope_result; } /* Make the ground dirty */ @@ -2874,7 +2874,7 @@ static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, uint extern const TileTypeProcs _tile_type_rail_procs = { DrawTile_Track, // draw_tile_proc - GetSlopeZ_Track, // get_slope_z_proc + GetSlopePixelZ_Track, // get_slope_z_proc ClearTile_Track, // clear_tile_proc NULL, // add_accepted_cargo_proc GetTileDesc_Track, // get_tile_desc_proc diff --git a/src/road.cpp b/src/road.cpp index 2c2af2a4d1..73c87deb5a 100644 --- a/src/road.cpp +++ b/src/road.cpp @@ -32,7 +32,7 @@ static bool IsPossibleCrossing(const TileIndex tile, Axis ax) return (IsTileType(tile, MP_RAILWAY) && GetRailTileType(tile) == RAIL_TILE_NORMAL && GetTrackBits(tile) == (ax == AXIS_X ? TRACK_BIT_Y : TRACK_BIT_X) && - GetFoundationSlope(tile, NULL) == SLOPE_FLAT); + GetFoundationPixelSlope(tile, NULL) == SLOPE_FLAT); } /** diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index e2df5d9509..3cc2bb8748 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -254,7 +254,7 @@ static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits piec switch (GetRoadTileType(tile)) { case ROAD_TILE_NORMAL: { - Slope tileh = GetTileSlope(tile, NULL); + Slope tileh = GetTilePixelSlope(tile, NULL); /* Steep slopes behave the same as slopes with one corner raised. */ if (IsSteepSlope(tileh)) { @@ -467,7 +467,7 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 DisallowedRoadDirections toggle_drd = Extract(p1); - Slope tileh = GetTileSlope(tile, NULL); + Slope tileh = GetTilePixelSlope(tile, NULL); bool need_to_clear = false; switch (GetTileType(tile)) { @@ -636,7 +636,7 @@ do_clear:; /* Check if new road bits will have the same foundation as other existing road types */ if (IsNormalRoad(tile)) { - Slope slope = GetTileSlope(tile, NULL); + Slope slope = GetTilePixelSlope(tile, NULL); Foundation found_new = GetRoadFoundation(slope, pieces | existing); /* Test if all other roadtypes can be built at that foundation */ @@ -909,7 +909,7 @@ CommandCost CmdBuildRoadDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, ui if (!IsValidRoadType(rt) || !ValParamRoadType(rt)) return CMD_ERROR; - Slope tileh = GetTileSlope(tile, NULL); + Slope tileh = GetTilePixelSlope(tile, NULL); if (tileh != SLOPE_FLAT && ( !_settings_game.construction.build_on_slopes || !CanBuildDepotByTileh(dir, tileh) @@ -1080,9 +1080,9 @@ void DrawTramCatenary(const TileInfo *ti, RoadBits tram) /* Don't draw the catenary under a low bridge */ if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && !IsTransparencySet(TO_CATENARY)) { - uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile)); + uint height = GetBridgePixelHeight(GetNorthernBridgeEnd(ti->tile)); - if (height <= GetTileMaxZ(ti->tile) + TILE_HEIGHT) return; + if (height <= GetTileMaxPixelZ(ti->tile) + TILE_HEIGHT) return; } SpriteID front; @@ -1113,7 +1113,7 @@ static void DrawRoadDetail(SpriteID img, const TileInfo *ti, int dx, int dy, int int x = ti->x | dx; int y = ti->y | dy; byte z = ti->z; - if (ti->tileh != SLOPE_FLAT) z = GetSlopeZ(x, y); + if (ti->tileh != SLOPE_FLAT) z = GetSlopePixelZ(x, y); AddSortableSpriteToDraw(img, PAL_NONE, x, y, 2, 2, h, z); } @@ -1170,7 +1170,7 @@ static void DrawRoadBits(TileInfo *ti) if (road != ROAD_NONE) { DisallowedRoadDirections drd = GetDisallowedRoadDirections(ti->tile); if (drd != DRD_NONE) { - DrawGroundSpriteAt(SPR_ONEWAY_BASE + drd - 1 + ((road == ROAD_X) ? 0 : 3), PAL_NONE, 8, 8, GetPartialZ(8, 8, ti->tileh)); + DrawGroundSpriteAt(SPR_ONEWAY_BASE + drd - 1 + ((road == ROAD_X) ? 0 : 3), PAL_NONE, 8, 8, GetPartialPixelZ(8, 8, ti->tileh)); } } @@ -1187,8 +1187,8 @@ static void DrawRoadBits(TileInfo *ti) /* Do not draw details (street lights, trees) under low bridge */ if (MayHaveBridgeAbove(ti->tile) && IsBridgeAbove(ti->tile) && (roadside == ROADSIDE_TREES || roadside == ROADSIDE_STREET_LIGHTS)) { - uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile)); - uint minz = GetTileMaxZ(ti->tile) + 2 * TILE_HEIGHT; + uint height = GetBridgePixelHeight(GetNorthernBridgeEnd(ti->tile)); + uint minz = GetTileMaxPixelZ(ti->tile) + 2 * TILE_HEIGHT; if (roadside == ROADSIDE_TREES) minz += TILE_HEIGHT; @@ -1337,19 +1337,19 @@ void UpdateNearestTownForRoadTiles(bool invalidate) } } -static uint GetSlopeZ_Road(TileIndex tile, uint x, uint y) +static uint GetSlopePixelZ_Road(TileIndex tile, uint x, uint y) { if (IsNormalRoad(tile)) { uint z; - Slope tileh = GetTileSlope(tile, &z); + Slope tileh = GetTilePixelSlope(tile, &z); if (tileh == SLOPE_FLAT) return z; Foundation f = GetRoadFoundation(tileh, GetAllRoadBits(tile)); - z += ApplyFoundationToSlope(f, &tileh); - return z + GetPartialZ(x & 0xF, y & 0xF, tileh); + z += ApplyPixelFoundationToSlope(f, &tileh); + return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh); } else { - return GetTileMaxZ(tile); + return GetTileMaxPixelZ(tile); } } @@ -1383,7 +1383,7 @@ static void TileLoop_Road(TileIndex tile) { switch (_settings_game.game_creation.landscape) { case LT_ARCTIC: - if (IsOnSnow(tile) != (GetTileZ(tile) > GetSnowLine())) { + if (IsOnSnow(tile) != (GetTilePixelZ(tile) > GetSnowLine())) { ToggleSnow(tile); MarkTileDirtyByTile(tile); } @@ -1410,7 +1410,7 @@ static void TileLoop_Road(TileIndex tile) if (t->road_build_months != 0 && (DistanceManhattan(t->xy, tile) < 8 || grp != HZB_TOWN_EDGE) && IsNormalRoad(tile) && !HasAtMostOneBit(GetAllRoadBits(tile))) { - if (GetFoundationSlope(tile, NULL) == SLOPE_FLAT && EnsureNoVehicleOnGround(tile).Succeeded() && Chance16(1, 40)) { + if (GetFoundationPixelSlope(tile, NULL) == SLOPE_FLAT && EnsureNoVehicleOnGround(tile).Succeeded() && Chance16(1, 40)) { StartRoadWorks(tile); SndPlayTileFx(SND_21_JACKHAMMER, tile); @@ -1682,7 +1682,7 @@ static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, uint if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) { switch (GetRoadTileType(tile)) { case ROAD_TILE_CROSSING: - if (!IsSteepSlope(tileh_new) && (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new)) && HasBit(VALID_LEVEL_CROSSING_SLOPES, tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]); + if (!IsSteepSlope(tileh_new) && (GetTileMaxPixelZ(tile) == z_new + GetSlopeMaxPixelZ(tileh_new)) && HasBit(VALID_LEVEL_CROSSING_SLOPES, tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]); break; case ROAD_TILE_DEPOT: @@ -1697,11 +1697,11 @@ static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, uint /* CheckRoadSlope() sometimes changes the road_bits, if it does not agree with them. */ if (bits == bits_copy) { uint z_old; - Slope tileh_old = GetTileSlope(tile, &z_old); + Slope tileh_old = GetTilePixelSlope(tile, &z_old); /* Get the slope on top of the foundation */ - z_old += ApplyFoundationToSlope(GetRoadFoundation(tileh_old, bits), &tileh_old); - z_new += ApplyFoundationToSlope(GetRoadFoundation(tileh_new, bits), &tileh_new); + z_old += ApplyPixelFoundationToSlope(GetRoadFoundation(tileh_old, bits), &tileh_old); + z_new += ApplyPixelFoundationToSlope(GetRoadFoundation(tileh_new, bits), &tileh_new); /* The surface slope must not be changed */ if ((z_old == z_new) && (tileh_old == tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price[PR_BUILD_FOUNDATION]); @@ -1720,7 +1720,7 @@ static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, uint /** Tile callback functions for road tiles */ extern const TileTypeProcs _tile_type_road_procs = { DrawTile_Road, // draw_tile_proc - GetSlopeZ_Road, // get_slope_z_proc + GetSlopePixelZ_Road, // get_slope_z_proc ClearTile_Road, // clear_tile_proc NULL, // add_accepted_cargo_proc GetTileDesc_Road, // get_tile_desc_proc diff --git a/src/roadveh.h b/src/roadveh.h index fbc8656361..06139a4264 100644 --- a/src/roadveh.h +++ b/src/roadveh.h @@ -268,13 +268,13 @@ protected: // These functions should not be called outside acceleration code. } /** - * Road vehicles have to use GetSlopeZ() to compute their height + * Road vehicles have to use GetSlopePixelZ() to compute their height * if they are reversing because in that case, their direction * is not parallel with the road. It is safe to return \c true * even if it is not reversing. * @return are we (possibly) reversing? */ - FORCEINLINE bool HasToUseGetSlopeZ() + FORCEINLINE bool HasToUseGetSlopePixelZ() { const RoadVehicle *rv = this->First(); diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index ee6961b39d..596c57862d 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -236,7 +236,7 @@ CommandCost CmdBuildRoadVehicle(TileIndex tile, DoCommandFlag flags, const Engin int y = TileY(tile) * TILE_SIZE + TILE_SIZE / 2; v->x_pos = x; v->y_pos = y; - v->z_pos = GetSlopeZ(x, y); + v->z_pos = GetSlopePixelZ(x, y); v->state = RVSB_IN_DEPOT; v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL; diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index d3fce84d0b..c8cc0dd819 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -77,7 +77,7 @@ void SetWaterClassDependingOnSurroundings(TileIndex t, bool include_invalid_wate { /* If the slope is not flat, we always assume 'land' (if allowed). Also for one-corner-raised-shores. * Note: Wrt. autosloping under industry tiles this is the most fool-proof behaviour. */ - if (GetTileSlope(t, NULL) != SLOPE_FLAT) { + if (GetTilePixelSlope(t, NULL) != SLOPE_FLAT) { if (include_invalid_water_class) { SetWaterClass(t, WATER_CLASS_INVALID); return; @@ -458,12 +458,12 @@ static uint FixVehicleInclination(Vehicle *v, Direction dir) case INVALID_DIR: break; default: NOT_REACHED(); } - byte entry_z = GetSlopeZ(entry_x, entry_y); + byte entry_z = GetSlopePixelZ(entry_x, entry_y); /* Compute middle of the tile. */ int middle_x = (v->x_pos & ~TILE_UNIT_MASK) + HALF_TILE_SIZE; int middle_y = (v->y_pos & ~TILE_UNIT_MASK) + HALF_TILE_SIZE; - byte middle_z = GetSlopeZ(middle_x, middle_y); + byte middle_z = GetSlopePixelZ(middle_x, middle_y); /* middle_z == entry_z, no height change. */ if (middle_z == entry_z) return 0; @@ -1060,7 +1060,7 @@ bool AfterLoadGame() if (GB(_m[t].m5, 3, 2) == 0) { MakeClear(t, CLEAR_GRASS, 3); } else { - if (GetTileSlope(t, NULL) != SLOPE_FLAT) { + if (GetTilePixelSlope(t, NULL) != SLOPE_FLAT) { MakeShore(t); } else { if (GetTileOwner(t) == OWNER_WATER) { @@ -1096,7 +1096,7 @@ bool AfterLoadGame() case DIAGDIR_SW: if ((v->x_pos & 0xF) != TILE_SIZE - 1) continue; break; case DIAGDIR_NW: if ((v->y_pos & 0xF) != 0) continue; break; } - } else if (v->z_pos > GetSlopeZ(v->x_pos, v->y_pos)) { + } else if (v->z_pos > GetSlopePixelZ(v->x_pos, v->y_pos)) { v->tile = GetNorthernBridgeEnd(v->tile); } else { continue; @@ -1670,7 +1670,7 @@ bool AfterLoadGame() * on its neighbouring tiles. Done after river and canal updates to * ensure neighbours are correct. */ for (TileIndex t = 0; t < map_size; t++) { - if (GetTileSlope(t, NULL) != SLOPE_FLAT) continue; + if (GetTilePixelSlope(t, NULL) != SLOPE_FLAT) continue; if (IsTileType(t, MP_WATER) && IsLock(t)) SetWaterClassDependingOnSurroundings(t, false); if (IsTileType(t, MP_STATION) && (IsDock(t) || IsBuoy(t))) SetWaterClassDependingOnSurroundings(t, false); @@ -2355,7 +2355,7 @@ bool AfterLoadGame() if (IsSavegameVersionBefore(149)) { for (TileIndex t = 0; t < map_size; t++) { if (!IsTileType(t, MP_STATION)) continue; - if (!IsBuoy(t) && !IsOilRig(t) && !(IsDock(t) && GetTileSlope(t, NULL) == SLOPE_FLAT)) { + if (!IsBuoy(t) && !IsOilRig(t) && !(IsDock(t) && GetTilePixelSlope(t, NULL) == SLOPE_FLAT)) { SetWaterClass(t, WATER_CLASS_INVALID); } } @@ -2394,7 +2394,7 @@ bool AfterLoadGame() if (!IsTunnelTile(vtile)) continue; /* Are we actually in this tunnel? Or maybe a lower tunnel? */ - if (GetSlopeZ(v->x_pos, v->y_pos) != v->z_pos) continue; + if (GetSlopePixelZ(v->x_pos, v->y_pos) != v->z_pos) continue; /* What way are we going? */ const DiagDirection dir = GetTunnelBridgeDirection(vtile); @@ -2544,7 +2544,7 @@ bool AfterLoadGame() /* In old versions, z_pos was 1 unit lower on bridge heads. * However, this invalid state could be converted to new savegames * by loading and saving the game in a new version. */ - v->z_pos = GetSlopeZ(v->x_pos, v->y_pos); + v->z_pos = GetSlopePixelZ(v->x_pos, v->y_pos); DiagDirection dir = GetTunnelBridgeDirection(v->tile); if (v->type == VEH_TRAIN && !(v->vehstatus & VS_CRASHED) && v->direction != DiagDirToDir(dir)) { @@ -2558,7 +2558,7 @@ bool AfterLoadGame() /* If the vehicle is really above v->tile (not in a wormhole), * it should have set v->z_pos correctly. */ - assert(v->tile != TileVirtXY(v->x_pos, v->y_pos) || v->z_pos == GetSlopeZ(v->x_pos, v->y_pos)); + assert(v->tile != TileVirtXY(v->x_pos, v->y_pos) || v->z_pos == GetSlopePixelZ(v->x_pos, v->y_pos)); } /* Fill Vehicle::cur_real_order_index */ diff --git a/src/ship_cmd.cpp b/src/ship_cmd.cpp index bfb3b56744..fe9367881a 100644 --- a/src/ship_cmd.cpp +++ b/src/ship_cmd.cpp @@ -596,7 +596,7 @@ static void ShipController(Ship *v) dir = ShipGetNewDirection(v, gp.x, gp.y); v->x_pos = gp.x; v->y_pos = gp.y; - v->z_pos = GetSlopeZ(gp.x, gp.y); + v->z_pos = GetSlopePixelZ(gp.x, gp.y); getout: v->UpdateViewport(true, true); @@ -644,7 +644,7 @@ CommandCost CmdBuildShip(TileIndex tile, DoCommandFlag flags, const Engine *e, u y = TileY(tile) * TILE_SIZE + TILE_SIZE / 2; v->x_pos = x; v->y_pos = y; - v->z_pos = GetSlopeZ(x, y); + v->z_pos = GetSlopePixelZ(x, y); v->UpdateDeltaXY(v->direction); v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL; diff --git a/src/signs_cmd.cpp b/src/signs_cmd.cpp index c70900fb00..80d399ae9c 100644 --- a/src/signs_cmd.cpp +++ b/src/signs_cmd.cpp @@ -51,7 +51,7 @@ CommandCost CmdPlaceSign(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 si->x = x; si->y = y; - si->z = GetSlopeZ(x, y); + si->z = GetSlopePixelZ(x, y); if (!StrEmpty(text)) { si->name = strdup(text); } diff --git a/src/slope_func.h b/src/slope_func.h index f151b4cd76..c36c89efda 100644 --- a/src/slope_func.h +++ b/src/slope_func.h @@ -159,7 +159,7 @@ static inline Corner GetHalftileSlopeCorner(Slope s) * @param s The #Slope. * @return Relative height of highest corner. */ -static inline uint GetSlopeMaxZ(Slope s) +static inline uint GetSlopeMaxPixelZ(Slope s) { if (s == SLOPE_FLAT) return 0; if (IsSteepSlope(s)) return 2 * TILE_HEIGHT; diff --git a/src/sound.cpp b/src/sound.cpp index 89d22244c6..f5016739c2 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -255,10 +255,10 @@ void SndPlayTileFx(SoundID sound, TileIndex tile) /* emits sound from center of the tile */ int x = min(MapMaxX() - 1, TileX(tile)) * TILE_SIZE + TILE_SIZE / 2; int y = min(MapMaxY() - 1, TileY(tile)) * TILE_SIZE - TILE_SIZE / 2; - uint z = (y < 0 ? 0 : GetSlopeZ(x, y)); + uint z = (y < 0 ? 0 : GetSlopePixelZ(x, y)); Point pt = RemapCoords(x, y, z); y += 2 * TILE_SIZE; - Point pt2 = RemapCoords(x, y, GetSlopeZ(x, y)); + Point pt2 = RemapCoords(x, y, GetSlopePixelZ(x, y)); SndPlayScreenCoordFx(sound, pt.x, pt2.x, pt.y, pt2.y); } diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index d798442142..fb76071560 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -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 diff --git a/src/terraform_cmd.cpp b/src/terraform_cmd.cpp index 7937d082e7..47a2326b28 100644 --- a/src/terraform_cmd.cpp +++ b/src/terraform_cmd.cpp @@ -311,7 +311,7 @@ CommandCost CmdTerraformLand(TileIndex tile, DoCommandFlag flags, uint32 p1, uin if (pass == 0) { /* Check if bridge would take damage */ if (direction == 1 && MayHaveBridgeAbove(tile) && IsBridgeAbove(tile) && - GetBridgeHeight(GetSouthernBridgeEnd(tile)) <= z_max * TILE_HEIGHT) { + GetBridgePixelHeight(GetSouthernBridgeEnd(tile)) <= z_max * TILE_HEIGHT) { _terraform_err_tile = tile; // highlight the tile under the bridge return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); } diff --git a/src/tile_map.cpp b/src/tile_map.cpp index 8d3fcc87fd..9fbcfbb8ab 100644 --- a/src/tile_map.cpp +++ b/src/tile_map.cpp @@ -18,7 +18,7 @@ * @param h If not \c NULL, pointer to storage of z height * @return Slope of the tile, except for the HALFTILE part */ -Slope GetTileSlope(TileIndex tile, uint *h) +Slope GetTilePixelSlope(TileIndex tile, uint *h) { assert(tile < MapSize()); @@ -64,7 +64,7 @@ Slope GetTileSlope(TileIndex tile, uint *h) * @param tile Tile to compute height of * @return Minimum height of the tile */ -uint GetTileZ(TileIndex tile) +uint GetTilePixelZ(TileIndex tile) { if (TileX(tile) == MapMaxX() || TileY(tile) == MapMaxY()) return 0; @@ -81,7 +81,7 @@ uint GetTileZ(TileIndex tile) * @param t Tile to compute height of * @return Maximum height of the tile */ -uint GetTileMaxZ(TileIndex t) +uint GetTileMaxPixelZ(TileIndex t) { if (TileX(t) == MapMaxX() || TileY(t) == MapMaxY()) return 0; diff --git a/src/tile_map.h b/src/tile_map.h index 420421e40c..fc7c01f84f 100644 --- a/src/tile_map.h +++ b/src/tile_map.h @@ -226,9 +226,9 @@ static inline void SetAnimationFrame(TileIndex t, byte frame) _me[t].m7 = frame; } -Slope GetTileSlope(TileIndex tile, uint *h); -uint GetTileZ(TileIndex tile); -uint GetTileMaxZ(TileIndex tile); +Slope GetTilePixelSlope(TileIndex tile, uint *h); +uint GetTilePixelZ(TileIndex tile); +uint GetTileMaxPixelZ(TileIndex tile); /** diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 550f85dcf0..e1c0f2cdc2 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -255,9 +255,9 @@ static void DrawTile_Town(TileInfo *ti) } } -static uint GetSlopeZ_Town(TileIndex tile, uint x, uint y) +static uint GetSlopePixelZ_Town(TileIndex tile, uint x, uint y) { - return GetTileMaxZ(tile); + return GetTileMaxPixelZ(tile); } /** Tile callback routine */ @@ -787,7 +787,7 @@ static bool IsRoadAllowedHere(Town *t, TileIndex tile, DiagDirection dir) } } - Slope cur_slope = _settings_game.construction.build_on_slopes ? GetFoundationSlope(tile, NULL) : GetTileSlope(tile, NULL); + Slope cur_slope = _settings_game.construction.build_on_slopes ? GetFoundationPixelSlope(tile, NULL) : GetTilePixelSlope(tile, NULL); bool ret = !IsNeighborRoadTile(tile, dir, t->layout == TL_ORIGINAL ? 1 : 2); if (cur_slope == SLOPE_FLAT) return ret; @@ -828,7 +828,7 @@ static void LevelTownLand(TileIndex tile) /* Don't terraform if land is plain or if there's a house there. */ if (IsTileType(tile, MP_HOUSE)) return; - Slope tileh = GetTileSlope(tile, NULL); + Slope tileh = GetTilePixelSlope(tile, NULL); if (tileh == SLOPE_FLAT) return; /* First try up, then down */ @@ -871,7 +871,7 @@ static RoadBits GetTownRoadGridElement(Town *t, TileIndex tile, DiagDirection di RoadBits rb_template; - switch (GetTileSlope(tile, NULL)) { + switch (GetTilePixelSlope(tile, NULL)) { default: rb_template = ROAD_ALL; break; case SLOPE_W: rb_template = ROAD_NW | ROAD_SW; break; case SLOPE_SW: rb_template = ROAD_Y | ROAD_SW; break; @@ -970,7 +970,7 @@ static bool GrowTownWithBridge(const Town *t, const TileIndex tile, const DiagDi { assert(bridge_dir < DIAGDIR_END); - const Slope slope = GetTileSlope(tile, NULL); + const Slope slope = GetTilePixelSlope(tile, NULL); /* Make sure the direction is compatible with the slope. * Well we check if the slope has an up bit set in the @@ -1337,7 +1337,7 @@ static bool GrowTown(Town *t) tile = t->xy; for (ptr = _town_coord_mod; ptr != endof(_town_coord_mod); ++ptr) { /* Only work with plain land that not already has a house */ - if (!IsTileType(tile, MP_HOUSE) && GetTileSlope(tile, NULL) == SLOPE_FLAT) { + if (!IsTileType(tile, MP_HOUSE) && GetTilePixelSlope(tile, NULL) == SLOPE_FLAT) { if (DoCommand(tile, 0, 0, DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR).Succeeded()) { DoCommand(tile, GenRandomRoadBits(), t->index, DC_EXEC | DC_AUTO, CMD_BUILD_ROAD); cur_company.Restore(); @@ -1500,7 +1500,7 @@ static CommandCost TownCanBePlacedHere(TileIndex tile) } /* Can only build on clear flat areas, possibly with trees. */ - if ((!IsTileType(tile, MP_CLEAR) && !IsTileType(tile, MP_TREES)) || GetTileSlope(tile, NULL) != SLOPE_FLAT) { + if ((!IsTileType(tile, MP_CLEAR) && !IsTileType(tile, MP_TREES)) || GetTilePixelSlope(tile, NULL) != SLOPE_FLAT) { return_cmd_error(STR_ERROR_SITE_UNSUITABLE); } @@ -1697,7 +1697,7 @@ static bool FindFurthestFromWater(TileIndex tile, void *user_data) uint dist = GetClosestWaterDistance(tile, true); if (IsTileType(tile, MP_CLEAR) && - GetTileSlope(tile, NULL) == SLOPE_FLAT && + GetTilePixelSlope(tile, NULL) == SLOPE_FLAT && IsTileAlignedToGrid(tile, sp->layout) && dist > sp->max_dist) { sp->tile = tile; @@ -1907,7 +1907,7 @@ static void MakeTownHouse(TileIndex t, Town *town, byte counter, byte stage, Hou static inline bool CanBuildHouseHere(TileIndex tile, TownID town, bool noslope) { /* cannot build on these slopes... */ - Slope slope = GetTileSlope(tile, NULL); + Slope slope = GetTilePixelSlope(tile, NULL); if ((noslope && slope != SLOPE_FLAT) || IsSteepSlope(slope)) return false; /* building under a bridge? */ @@ -1935,7 +1935,7 @@ static inline bool CheckBuildHouseSameZ(TileIndex tile, TownID town, uint z, boo if (!CanBuildHouseHere(tile, town, noslope)) return false; /* if building on slopes is allowed, there will be flattening foundation (to tile max z) */ - if (GetTileMaxZ(tile) != z) return false; + if (GetTileMaxPixelZ(tile) != z) return false; return true; } @@ -2096,7 +2096,7 @@ static bool BuildTownHouse(Town *t, TileIndex tile) if (!CanBuildHouseHere(tile, t->index, false)) return false; uint z; - Slope slope = GetTileSlope(tile, &z); + Slope slope = GetTilePixelSlope(tile, &z); /* Get the town zone type of the current tile, as well as the climate. * This will allow to easily compare with the specs of the new house to build */ @@ -2139,7 +2139,7 @@ static bool BuildTownHouse(Town *t, TileIndex tile) houses[num++] = (HouseID)i; } - uint maxz = GetTileMaxZ(tile); + uint maxz = GetTileMaxPixelZ(tile); TileIndex baseTile = tile; while (probability_max > 0) { @@ -2525,7 +2525,7 @@ static CommandCost TownActionRoadRebuild(Town *t, DoCommandFlag flags) static bool SearchTileForStatue(TileIndex tile, void *user_data) { /* Statues can be build on slopes, just like houses. Only the steep slopes is a no go. */ - if (IsSteepSlope(GetTileSlope(tile, NULL))) return false; + if (IsSteepSlope(GetTilePixelSlope(tile, NULL))) return false; /* Don't build statues under bridges. */ if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return false; @@ -3055,7 +3055,7 @@ static CommandCost TerraformTile_Town(TileIndex tile, DoCommandFlag flags, uint /* Here we differ from TTDP by checking TILE_NOT_SLOPED */ if (((hs->building_flags & TILE_NOT_SLOPED) == 0) && !IsSteepSlope(tileh_new) && - (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new))) { + (GetTileMaxPixelZ(tile) == z_new + GetSlopeMaxPixelZ(tileh_new))) { bool allow_terraform = true; /* Call the autosloping callback per tile, not for the whole building at once. */ @@ -3077,7 +3077,7 @@ static CommandCost TerraformTile_Town(TileIndex tile, DoCommandFlag flags, uint /** Tile callback functions for a town */ extern const TileTypeProcs _tile_type_town_procs = { DrawTile_Town, // draw_tile_proc - GetSlopeZ_Town, // get_slope_z_proc + GetSlopePixelZ_Town, // get_slope_z_proc ClearTile_Town, // clear_tile_proc AddAcceptedCargo_Town, // add_accepted_cargo_proc GetTileDesc_Town, // get_tile_desc_proc diff --git a/src/train.h b/src/train.h index 49915631cc..ad273e0358 100644 --- a/src/train.h +++ b/src/train.h @@ -303,7 +303,7 @@ protected: // These functions should not be called outside acceleration code. * have always the same direction as the track under them. * @return false */ - FORCEINLINE bool HasToUseGetSlopeZ() + FORCEINLINE bool HasToUseGetSlopePixelZ() { return false; } diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp index 82f4293b4b..19ebffb9c8 100644 --- a/src/train_cmd.cpp +++ b/src/train_cmd.cpp @@ -573,7 +573,7 @@ static CommandCost CmdBuildRailWagon(TileIndex tile, DoCommandFlag flags, const v->x_pos = x; v->y_pos = y; - v->z_pos = GetSlopeZ(x, y); + v->z_pos = GetSlopePixelZ(x, y); v->owner = _current_company; v->track = TRACK_BIT_DEPOT; v->vehstatus = VS_HIDDEN | VS_DEFPAL; @@ -698,7 +698,7 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, DoCommandFlag flags, const Engin v->owner = _current_company; v->x_pos = x; v->y_pos = y; - v->z_pos = GetSlopeZ(x, y); + v->z_pos = GetSlopePixelZ(x, y); v->track = TRACK_BIT_DEPOT; v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL; v->spritenum = rvi->image_index; diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp index ea1656a00a..4240c1eed4 100644 --- a/src/tree_cmd.cpp +++ b/src/tree_cmd.cpp @@ -70,7 +70,7 @@ static bool CanPlantTreesOnTile(TileIndex tile, bool allow_desert) { switch (GetTileType(tile)) { case MP_WATER: - return !IsBridgeAbove(tile) && IsCoast(tile) && !IsSlopeWithOneCornerRaised(GetTileSlope(tile, NULL)); + return !IsBridgeAbove(tile) && IsCoast(tile) && !IsSlopeWithOneCornerRaised(GetTilePixelSlope(tile, NULL)); case MP_CLEAR: return !IsBridgeAbove(tile) && !IsClearGround(tile, CLEAR_FIELDS) && GetRawClearGround(tile) != CLEAR_ROCKS && @@ -232,7 +232,7 @@ static void PlaceTreeAtSameHeight(TileIndex tile, uint height) if (!CanPlantTreesOnTile(cur_tile, true)) continue; /* Not too much height difference */ - if (Delta(GetTileZ(cur_tile), height) > 2) continue; + if (Delta(GetTilePixelZ(cur_tile), height) > 2) continue; /* Place one tree and quit */ PlaceTree(cur_tile, r); @@ -264,9 +264,9 @@ void PlaceTreesRandomly() /* Place a number of trees based on the tile height. * This gives a cool effect of multiple trees close together. * It is almost real life ;) */ - ht = GetTileZ(tile); + ht = GetTilePixelZ(tile); /* The higher we get, the more trees we plant */ - j = GetTileZ(tile) / TILE_HEIGHT * 2; + j = GetTilePixelZ(tile) / TILE_HEIGHT * 2; /* Above snowline more trees! */ if (_settings_game.game_creation.landscape == LT_ARCTIC && ht > GetSnowLine()) j *= 3; while (j--) { @@ -363,7 +363,7 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 break; case MP_WATER: - if (!IsCoast(tile) || IsSlopeWithOneCornerRaised(GetTileSlope(tile, NULL))) { + if (!IsCoast(tile) || IsSlopeWithOneCornerRaised(GetTilePixelSlope(tile, NULL))) { msg = STR_ERROR_CAN_T_BUILD_ON_WATER; continue; } @@ -493,7 +493,7 @@ static void DrawTile_Trees(TileInfo *ti) } /* draw them in a sorted way */ - byte z = ti->z + GetSlopeMaxZ(ti->tileh) / 2; + byte z = ti->z + GetSlopeMaxPixelZ(ti->tileh) / 2; for (; trees > 0; trees--) { uint min = te[0].x + te[0].y; @@ -516,12 +516,12 @@ static void DrawTile_Trees(TileInfo *ti) } -static uint GetSlopeZ_Trees(TileIndex tile, uint x, uint y) +static uint GetSlopePixelZ_Trees(TileIndex tile, uint x, uint y) { uint z; - Slope tileh = GetTileSlope(tile, &z); + Slope tileh = GetTilePixelSlope(tile, &z); - return z + GetPartialZ(x & 0xF, y & 0xF, tileh); + return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh); } static Foundation GetFoundation_Trees(TileIndex tile, Slope tileh) @@ -588,7 +588,7 @@ static void TileLoopTreesDesert(TileIndex tile) static void TileLoopTreesAlps(TileIndex tile) { - int k = GetTileZ(tile) - GetSnowLine() + TILE_HEIGHT; + int k = GetTilePixelZ(tile) - GetSnowLine() + TILE_HEIGHT; if (k < 0) { switch (GetTreeGround(tile)) { @@ -784,7 +784,7 @@ static CommandCost TerraformTile_Trees(TileIndex tile, DoCommandFlag flags, uint extern const TileTypeProcs _tile_type_trees_procs = { DrawTile_Trees, // draw_tile_proc - GetSlopeZ_Trees, // get_slope_z_proc + GetSlopePixelZ_Trees, // get_slope_z_proc ClearTile_Trees, // clear_tile_proc NULL, // add_accepted_cargo_proc GetTileDesc_Trees, // get_tile_desc_proc diff --git a/src/tunnel_map.cpp b/src/tunnel_map.cpp index 799b390007..2aac58424e 100644 --- a/src/tunnel_map.cpp +++ b/src/tunnel_map.cpp @@ -23,7 +23,7 @@ TileIndex GetOtherTunnelEnd(TileIndex tile) { DiagDirection dir = GetTunnelBridgeDirection(tile); TileIndexDiff delta = TileOffsByDiagDir(dir); - uint z = GetTileZ(tile); + uint z = GetTilePixelZ(tile); dir = ReverseDiagDir(dir); do { @@ -31,7 +31,7 @@ TileIndex GetOtherTunnelEnd(TileIndex tile) } while ( !IsTunnelTile(tile) || GetTunnelBridgeDirection(tile) != dir || - GetTileZ(tile) != z + GetTilePixelZ(tile) != z ); return tile; @@ -53,7 +53,7 @@ bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir) do { tile -= delta; if (!IsValidTile(tile)) return false; - height = GetTileZ(tile); + height = GetTilePixelZ(tile); } while (z < height); return z == height && IsTunnelTile(tile) && GetTunnelBridgeDirection(tile) == dir; diff --git a/src/tunnelbridge_cmd.cpp b/src/tunnelbridge_cmd.cpp index 3d8ee89370..7001515607 100644 --- a/src/tunnelbridge_cmd.cpp +++ b/src/tunnelbridge_cmd.cpp @@ -113,7 +113,7 @@ Foundation GetBridgeFoundation(Slope tileh, Axis axis) */ bool HasBridgeFlatRamp(Slope tileh, Axis axis) { - ApplyFoundationToSlope(GetBridgeFoundation(tileh, axis), &tileh); + ApplyPixelFoundationToSlope(GetBridgeFoundation(tileh, axis), &tileh); /* If the foundation slope is flat the bridge has a non-flat ramp and vice versa. */ return (tileh != SLOPE_FLAT); } @@ -141,7 +141,7 @@ static inline const PalSpriteID *GetBridgeSpriteTable(int index, BridgePieces ta static CommandCost CheckBridgeSlopeNorth(Axis axis, Slope *tileh, uint *z) { Foundation f = GetBridgeFoundation(*tileh, axis); - *z += ApplyFoundationToSlope(f, tileh); + *z += ApplyPixelFoundationToSlope(f, tileh); Slope valid_inclined = (axis == AXIS_X ? SLOPE_NE : SLOPE_NW); if ((*tileh != SLOPE_FLAT) && (*tileh != valid_inclined)) return CMD_ERROR; @@ -162,7 +162,7 @@ static CommandCost CheckBridgeSlopeNorth(Axis axis, Slope *tileh, uint *z) static CommandCost CheckBridgeSlopeSouth(Axis axis, Slope *tileh, uint *z) { Foundation f = GetBridgeFoundation(*tileh, axis); - *z += ApplyFoundationToSlope(f, tileh); + *z += ApplyPixelFoundationToSlope(f, tileh); Slope valid_inclined = (axis == AXIS_X ? SLOPE_SW : SLOPE_SE); if ((*tileh != SLOPE_FLAT) && (*tileh != valid_inclined)) return CMD_ERROR; @@ -269,8 +269,8 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u uint z_start; uint z_end; - Slope tileh_start = GetTileSlope(tile_start, &z_start); - Slope tileh_end = GetTileSlope(tile_end, &z_end); + Slope tileh_start = GetTilePixelSlope(tile_start, &z_start); + Slope tileh_end = GetTilePixelSlope(tile_end, &z_end); bool pbs_reservation = false; CommandCost terraform_cost_north = CheckBridgeSlopeNorth(direction, &tileh_start, &z_start); @@ -361,7 +361,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u if (direction == GetBridgeAxis(heads[i])) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); - if (z_start + TILE_HEIGHT == GetBridgeHeight(north_head)) { + if (z_start + TILE_HEIGHT == GetBridgePixelHeight(north_head)) { return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); } } @@ -370,7 +370,7 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u TileIndexDiff delta = (direction == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1)); for (TileIndex tile = tile_start + delta; tile != tile_end; tile += delta) { - if (GetTileMaxZ(tile) > z_start) return_cmd_error(STR_ERROR_BRIDGE_TOO_LOW_FOR_TERRAIN); + if (GetTileMaxPixelZ(tile) > z_start) return_cmd_error(STR_ERROR_BRIDGE_TOO_LOW_FOR_TERRAIN); if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) { /* Disallow crossing bridges for the time being */ @@ -393,13 +393,13 @@ CommandCost CmdBuildBridge(TileIndex end_tile, DoCommandFlag flags, uint32 p1, u case MP_TUNNELBRIDGE: if (IsTunnel(tile)) break; if (direction == DiagDirToAxis(GetTunnelBridgeDirection(tile))) goto not_valid_below; - if (z_start < GetBridgeHeight(tile)) goto not_valid_below; + if (z_start < GetBridgePixelHeight(tile)) goto not_valid_below; break; case MP_OBJECT: { const ObjectSpec *spec = ObjectSpec::GetByTile(tile); if ((spec->flags & OBJECT_FLAG_ALLOW_UNDER_BRIDGE) == 0) goto not_valid_below; - if (GetTileMaxZ(tile) + spec->height * TILE_HEIGHT > z_start) goto not_valid_below; + if (GetTileMaxPixelZ(tile) + spec->height * TILE_HEIGHT > z_start) goto not_valid_below; break; } @@ -527,7 +527,7 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1, uint start_z; uint end_z; - Slope start_tileh = GetTileSlope(start_tile, &start_z); + Slope start_tileh = GetTilePixelSlope(start_tile, &start_z); DiagDirection direction = GetInclinedSlopeDirection(start_tileh); if (direction == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_SITE_UNSUITABLE_FOR_TUNNEL); @@ -563,7 +563,7 @@ CommandCost CmdBuildTunnel(TileIndex start_tile, DoCommandFlag flags, uint32 p1, for (;;) { end_tile += delta; if (!IsValidTile(end_tile)) return_cmd_error(STR_ERROR_TUNNEL_THROUGH_MAP_BORDER); - end_tileh = GetTileSlope(end_tile, &end_z); + end_tileh = GetTilePixelSlope(end_tile, &end_z); if (start_z == end_z) break; @@ -794,7 +794,7 @@ static CommandCost DoClearBridge(TileIndex tile, DoCommandFlag flags) /* read this value before actual removal of bridge */ bool rail = GetTunnelBridgeTransportType(tile) == TRANSPORT_RAIL; Owner owner = GetTileOwner(tile); - uint height = GetBridgeHeight(tile); + uint height = GetBridgePixelHeight(tile); Train *v = NULL; if (rail && HasTunnelBridgeReservation(tile)) { @@ -807,7 +807,7 @@ static CommandCost DoClearBridge(TileIndex tile, DoCommandFlag flags) for (TileIndex c = tile + delta; c != endtile; c += delta) { /* do not let trees appear from 'nowhere' after removing bridge */ if (IsNormalRoadTile(c) && GetRoadside(c) == ROADSIDE_TREES) { - uint minz = GetTileMaxZ(c) + 3 * TILE_HEIGHT; + uint minz = GetTileMaxPixelZ(c) + 3 * TILE_HEIGHT; if (height < minz) SetRoadside(c, ROADSIDE_PAVED); } ClearBridgeMiddle(c); @@ -913,8 +913,8 @@ static void DrawBridgePillars(const PalSpriteID *psid, const TileInfo *ti, Axis int z_back_north = ti->z; int z_front_south = ti->z; int z_back_south = ti->z; - GetSlopeZOnEdge(ti->tileh, south_dir, &z_front_south, &z_back_south); - GetSlopeZOnEdge(ti->tileh, ReverseDiagDir(south_dir), &z_front_north, &z_back_north); + GetSlopePixelZOnEdge(ti->tileh, south_dir, &z_front_south, &z_back_south); + GetSlopePixelZOnEdge(ti->tileh, ReverseDiagDir(south_dir), &z_front_north, &z_back_north); /* Shared height of pillars */ int z_front = max(z_front_north, z_front_south); @@ -1277,7 +1277,7 @@ void DrawBridgeMiddle(const TileInfo *ti) int x = ti->x; int y = ti->y; - uint bridge_z = GetBridgeHeight(rampsouth); + uint bridge_z = GetBridgePixelHeight(rampsouth); uint z = bridge_z - BRIDGE_Z_START; /* Add a bounding box that separates the bridge from things below it. */ @@ -1359,10 +1359,10 @@ void DrawBridgeMiddle(const TileInfo *ti) } -static uint GetSlopeZ_TunnelBridge(TileIndex tile, uint x, uint y) +static uint GetSlopePixelZ_TunnelBridge(TileIndex tile, uint x, uint y) { uint z; - Slope tileh = GetTileSlope(tile, &z); + Slope tileh = GetTilePixelSlope(tile, &z); x &= 0xF; y &= 0xF; @@ -1376,7 +1376,7 @@ static uint GetSlopeZ_TunnelBridge(TileIndex tile, uint x, uint y) DiagDirection dir = GetTunnelBridgeDirection(tile); uint pos = (DiagDirToAxis(dir) == AXIS_X ? y : x); - z += ApplyFoundationToSlope(GetBridgeFoundation(tileh, DiagDirToAxis(dir)), &tileh); + z += ApplyPixelFoundationToSlope(GetBridgeFoundation(tileh, DiagDirToAxis(dir)), &tileh); /* On the bridge ramp? */ if (5 <= pos && pos <= 10) { @@ -1395,7 +1395,7 @@ static uint GetSlopeZ_TunnelBridge(TileIndex tile, uint x, uint y) } } - return z + GetPartialZ(x, y, tileh); + return z + GetPartialPixelZ(x, y, tileh); } static Foundation GetFoundation_TunnelBridge(TileIndex tile, Slope tileh) @@ -1457,7 +1457,7 @@ static void TileLoop_TunnelBridge(TileIndex tile) /* As long as we do not have a snow density, we want to use the density * from the entry endge. For tunnels this is the lowest point for bridges the highest point. * (Independent of foundations) */ - uint z = IsBridge(tile) ? GetTileMaxZ(tile) : GetTileZ(tile); + uint z = IsBridge(tile) ? GetTileMaxPixelZ(tile) : GetTilePixelZ(tile); if (snow_or_desert != (z > GetSnowLine())) { SetTunnelBridgeSnowOrDesert(tile, !snow_or_desert); MarkTileDirtyByTile(tile); @@ -1532,7 +1532,7 @@ extern const byte _tunnel_visibility_frame[DIAGDIR_END] = {12, 8, 8, 12}; static VehicleEnterTileStatus VehicleEnter_TunnelBridge(Vehicle *v, TileIndex tile, int x, int y) { - int z = GetSlopeZ(x, y) - v->z_pos; + int z = GetSlopePixelZ(x, y) - v->z_pos; if (abs(z) > 2) return VETSB_CANNOT_ENTER; /* Direction into the wormhole */ @@ -1680,7 +1680,7 @@ static CommandCost TerraformTile_TunnelBridge(TileIndex tile, DoCommandFlag flag Axis axis = DiagDirToAxis(direction); CommandCost res; uint z_old; - Slope tileh_old = GetTileSlope(tile, &z_old); + Slope tileh_old = GetTilePixelSlope(tile, &z_old); /* Check if new slope is valid for bridges in general (so we can safely call GetBridgeFoundation()) */ if ((direction == DIAGDIR_NW) || (direction == DIAGDIR_NE)) { @@ -1700,7 +1700,7 @@ static CommandCost TerraformTile_TunnelBridge(TileIndex tile, DoCommandFlag flag extern const TileTypeProcs _tile_type_tunnelbridge_procs = { DrawTile_TunnelBridge, // draw_tile_proc - GetSlopeZ_TunnelBridge, // get_slope_z_proc + GetSlopePixelZ_TunnelBridge, // get_slope_z_proc ClearTile_TunnelBridge, // clear_tile_proc NULL, // add_accepted_cargo_proc GetTileDesc_TunnelBridge, // get_tile_desc_proc diff --git a/src/vehicle.cpp b/src/vehicle.cpp index 7110cb46b6..b4a9e9e170 100644 --- a/src/vehicle.cpp +++ b/src/vehicle.cpp @@ -430,7 +430,7 @@ static Vehicle *EnsureNoVehicleProcZ(Vehicle *v, void *data) */ CommandCost EnsureNoVehicleOnGround(TileIndex tile) { - byte z = GetTileMaxZ(tile); + byte z = GetTileMaxPixelZ(tile); /* Value v is not safe in MP games, however, it is used to generate a local * error message only (which may be different for different machines). diff --git a/src/viewport.cpp b/src/viewport.cpp index d118df534b..a587a872e7 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -205,7 +205,7 @@ void InitializeWindowViewport(Window *w, int x, int y, uint y = TileY(follow_flags) * TILE_SIZE; vp->follow_vehicle = INVALID_VEHICLE; - pt = MapXYZToViewport(vp, x, y, GetSlopeZ(x, y)); + pt = MapXYZToViewport(vp, x, y, GetSlopePixelZ(x, y)); } vp->scrollpos_x = pt.x; @@ -400,9 +400,9 @@ static Point TranslateXYToTileCoord(const ViewPort *vp, int x, int y) int min_coord = _settings_game.construction.freeform_edges ? TILE_SIZE : 0; - for (int i = 0; i < 5; i++) z = GetSlopeZ(Clamp(a + (int)max(z, 4u) - 4, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + (int)max(z, 4u) - 4, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2; - for (uint malus = 3; malus > 0; malus--) z = GetSlopeZ(Clamp(a + (int)max(z, malus) - (int)malus, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + (int)max(z, malus) - (int)malus, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2; - for (int i = 0; i < 5; i++) z = GetSlopeZ(Clamp(a + (int)z, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + (int)z, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2; + for (int i = 0; i < 5; i++) z = GetSlopePixelZ(Clamp(a + (int)max(z, 4u) - 4, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + (int)max(z, 4u) - 4, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2; + for (uint malus = 3; malus > 0; malus--) z = GetSlopePixelZ(Clamp(a + (int)max(z, malus) - (int)malus, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + (int)max(z, malus) - (int)malus, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2; + for (int i = 0; i < 5; i++) z = GetSlopePixelZ(Clamp(a + (int)z, min_coord, MapMaxX() * TILE_SIZE - 1), Clamp(b + (int)z, min_coord, MapMaxY() * TILE_SIZE - 1)) / 2; pt.x = Clamp(a + (int)z, min_coord, MapMaxX() * TILE_SIZE - 1); pt.y = Clamp(b + (int)z, min_coord, MapMaxY() * TILE_SIZE - 1); @@ -1084,7 +1084,7 @@ static void ViewportAddLandscape() } ti.tile = tile; - ti.tileh = GetTileSlope(tile, &ti.z); + ti.tileh = GetTilePixelSlope(tile, &ti.z); tt = GetTileType(tile); } } @@ -1101,7 +1101,7 @@ static void ViewportAddLandscape() (y_cur == (int)MapMaxY() * TILE_SIZE && IsInsideMM(x_cur, 0, MapMaxX() * TILE_SIZE + 1))) { TileIndex tile = TileVirtXY(x_cur, y_cur); ti.tile = tile; - ti.tileh = GetTileSlope(tile, &ti.z); + ti.tileh = GetTilePixelSlope(tile, &ti.z); tt = GetTileType(tile); } if (ti.tile != INVALID_TILE) DrawTileSelection(&ti); @@ -1652,7 +1652,7 @@ void MarkAllViewportsDirty(int left, int top, int right, int bottom) */ void MarkTileDirtyByTile(TileIndex tile) { - Point pt = RemapCoords(TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE, GetTileZ(tile)); + Point pt = RemapCoords(TileX(tile) * TILE_SIZE, TileY(tile) * TILE_SIZE, GetTilePixelZ(tile)); MarkAllViewportsDirty( pt.x - 31, pt.y - 122, @@ -1725,11 +1725,11 @@ static void SetSelectionTilesDirty() do { /* topmost dirty point */ TileIndex top_tile = TileVirtXY(top_x, top_y); - Point top = RemapCoords(top_x, top_y, GetTileMaxZ(top_tile)); + Point top = RemapCoords(top_x, top_y, GetTileMaxPixelZ(top_tile)); /* bottommost point */ TileIndex bottom_tile = TileVirtXY(bot_x, bot_y); - Point bot = RemapCoords(bot_x + TILE_SIZE, bot_y + TILE_SIZE, GetTileZ(bottom_tile)); // bottommost point + Point bot = RemapCoords(bot_x + TILE_SIZE, bot_y + TILE_SIZE, GetTilePixelZ(bottom_tile)); // bottommost point /* the 'x' coordinate of 'top' and 'bot' is the same (and always in the same distance from tile middle), * tile height/slope affects only the 'y' on-screen coordinate! */ @@ -1946,7 +1946,7 @@ bool HandleViewportClicked(const ViewPort *vp, int x, int y) bool ScrollWindowTo(int x, int y, int z, Window *w, bool instant) { /* The slope cannot be acquired outside of the map, so make sure we are always within the map. */ - if (z == -1) z = GetSlopeZ(Clamp(x, 0, MapSizeX() * TILE_SIZE - 1), Clamp(y, 0, MapSizeY() * TILE_SIZE - 1)); + if (z == -1) z = GetSlopePixelZ(Clamp(x, 0, MapSizeX() * TILE_SIZE - 1), Clamp(y, 0, MapSizeY() * TILE_SIZE - 1)); Point pt = MapXYZToViewport(w->viewport, x, y, z); w->viewport->follow_vehicle = INVALID_VEHICLE; diff --git a/src/void_cmd.cpp b/src/void_cmd.cpp index e80f961c14..fb36d90cfc 100644 --- a/src/void_cmd.cpp +++ b/src/void_cmd.cpp @@ -23,7 +23,7 @@ static void DrawTile_Void(TileInfo *ti) } -static uint GetSlopeZ_Void(TileIndex tile, uint x, uint y) +static uint GetSlopePixelZ_Void(TileIndex tile, uint x, uint y) { return TilePixelHeight(tile); } @@ -67,7 +67,7 @@ static CommandCost TerraformTile_Void(TileIndex tile, DoCommandFlag flags, uint extern const TileTypeProcs _tile_type_void_procs = { DrawTile_Void, // draw_tile_proc - GetSlopeZ_Void, // get_slope_z_proc + GetSlopePixelZ_Void, // get_slope_z_proc ClearTile_Void, // clear_tile_proc NULL, // add_accepted_cargo_proc GetTileDesc_Void, // get_tile_desc_proc diff --git a/src/water_cmd.cpp b/src/water_cmd.cpp index efb3152d1e..4ee42554b9 100644 --- a/src/water_cmd.cpp +++ b/src/water_cmd.cpp @@ -106,7 +106,7 @@ CommandCost CmdBuildShipDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, ui if ((MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) || (MayHaveBridgeAbove(tile2) && IsBridgeAbove(tile2))) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); - if (GetTileSlope(tile, NULL) != SLOPE_FLAT || GetTileSlope(tile2, NULL) != SLOPE_FLAT) { + if (GetTilePixelSlope(tile, NULL) != SLOPE_FLAT || GetTilePixelSlope(tile2, NULL) != SLOPE_FLAT) { /* Prevent depots on rapids */ return_cmd_error(STR_ERROR_SITE_UNSUITABLE); } @@ -150,7 +150,7 @@ void MakeWaterKeepingClass(TileIndex tile, Owner o) /* Autoslope might turn an originally canal or river tile into land */ uint z; - if (GetTileSlope(tile, &z) != SLOPE_FLAT) wc = WATER_CLASS_INVALID; + if (GetTilePixelSlope(tile, &z) != SLOPE_FLAT) wc = WATER_CLASS_INVALID; if (wc == WATER_CLASS_SEA && z > 0) wc = WATER_CLASS_CANAL; @@ -220,7 +220,7 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag cost.AddCost(ret); cost.AddCost(_price[PR_BUILD_CANAL]); } - if (GetTileSlope(tile - delta, NULL) != SLOPE_FLAT) { + if (GetTilePixelSlope(tile - delta, NULL) != SLOPE_FLAT) { return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION); } @@ -233,7 +233,7 @@ static CommandCost DoBuildLock(TileIndex tile, DiagDirection dir, DoCommandFlag cost.AddCost(ret); cost.AddCost(_price[PR_BUILD_CANAL]); } - if (GetTileSlope(tile + delta, NULL) != SLOPE_FLAT) { + if (GetTilePixelSlope(tile + delta, NULL) != SLOPE_FLAT) { return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION); } @@ -299,7 +299,7 @@ static CommandCost RemoveLock(TileIndex tile, DoCommandFlag flags) */ CommandCost CmdBuildLock(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) { - DiagDirection dir = GetInclinedSlopeDirection(GetTileSlope(tile, NULL)); + DiagDirection dir = GetInclinedSlopeDirection(GetTilePixelSlope(tile, NULL)); if (dir == INVALID_DIAGDIR) return_cmd_error(STR_ERROR_LAND_SLOPED_IN_WRONG_DIRECTION); /* Disallow building of locks on river rapids */ @@ -341,7 +341,7 @@ CommandCost CmdBuildCanal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 TILE_AREA_LOOP(tile, ta) { CommandCost ret; - Slope slope = GetTileSlope(tile, NULL); + Slope slope = GetTilePixelSlope(tile, NULL); if (slope != SLOPE_FLAT && (wc != WATER_CLASS_RIVER || !IsInclinedSlope(slope))) { return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED); } @@ -419,7 +419,7 @@ static CommandCost ClearTile_Water(TileIndex tile, DoCommandFlag flags) } case WATER_TILE_COAST: { - Slope slope = GetTileSlope(tile, NULL); + Slope slope = GetTilePixelSlope(tile, NULL); /* Make sure no vehicle is on the tile */ CommandCost ret = EnsureNoVehicleOnGround(tile); @@ -477,7 +477,7 @@ static bool IsWateredTile(TileIndex tile, Direction from) case WATER_TILE_LOCK: return DiagDirToAxis(GetLockDirection(tile)) == DiagDirToAxis(DirToDiagDir(from)); case WATER_TILE_COAST: - switch (GetTileSlope(tile, NULL)) { + switch (GetTilePixelSlope(tile, NULL)) { case SLOPE_W: return (from == DIR_SE) || (from == DIR_E) || (from == DIR_NE); case SLOPE_S: return (from == DIR_NE) || (from == DIR_N) || (from == DIR_NW); case SLOPE_E: return (from == DIR_NW) || (from == DIR_W) || (from == DIR_SW); @@ -489,7 +489,7 @@ static bool IsWateredTile(TileIndex tile, Direction from) case MP_RAILWAY: if (GetRailGroundType(tile) == RAIL_GROUND_WATER) { assert(IsPlainRail(tile)); - switch (GetTileSlope(tile, NULL)) { + switch (GetTilePixelSlope(tile, NULL)) { case SLOPE_W: return (from == DIR_SE) || (from == DIR_E) || (from == DIR_NE); case SLOPE_S: return (from == DIR_NE) || (from == DIR_N) || (from == DIR_NW); case SLOPE_E: return (from == DIR_NW) || (from == DIR_W) || (from == DIR_SW); @@ -509,7 +509,7 @@ static bool IsWateredTile(TileIndex tile, Direction from) return IsTileOnWater(tile); } - return (IsDock(tile) && GetTileSlope(tile, NULL) == SLOPE_FLAT) || IsBuoy(tile); + return (IsDock(tile) && GetTilePixelSlope(tile, NULL) == SLOPE_FLAT) || IsBuoy(tile); case MP_INDUSTRY: { /* Do not draw waterborders inside of industries. @@ -794,12 +794,12 @@ void DrawShipDepotSprite(int x, int y, Axis axis, DepotPart part) } -static uint GetSlopeZ_Water(TileIndex tile, uint x, uint y) +static uint GetSlopePixelZ_Water(TileIndex tile, uint x, uint y) { uint z; - Slope tileh = GetTileSlope(tile, &z); + Slope tileh = GetTilePixelSlope(tile, &z); - return z + GetPartialZ(x & 0xF, y & 0xF, tileh); + return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh); } static Foundation GetFoundation_Water(TileIndex tile, Slope tileh) @@ -860,7 +860,7 @@ static Vehicle *FloodVehicleProc(Vehicle *v, void *data) default: break; case VEH_AIRCRAFT: { - if (!IsAirportTile(v->tile) || GetTileMaxZ(v->tile) != 0) break; + if (!IsAirportTile(v->tile) || GetTileMaxPixelZ(v->tile) != 0) break; if (v->subtype == AIR_SHADOW) break; /* We compare v->z_pos against delta_z + 1 because the shadow @@ -910,7 +910,7 @@ static void FloodVehicles(TileIndex tile) } TileIndex end = GetOtherBridgeEnd(tile); - z = GetBridgeHeight(tile); + z = GetBridgePixelHeight(tile); FindVehicleOnPos(tile, &z, &FloodVehicleProc); FindVehicleOnPos(end, &z, &FloodVehicleProc); @@ -931,7 +931,7 @@ FloodingBehaviour GetFloodingBehaviour(TileIndex tile) switch (GetTileType(tile)) { case MP_WATER: if (IsCoast(tile)) { - Slope tileh = GetTileSlope(tile, NULL); + Slope tileh = GetTilePixelSlope(tile, NULL); return (IsSlopeWithOneCornerRaised(tileh) ? FLOOD_ACTIVE : FLOOD_DRYUP); } /* FALL THROUGH */ @@ -942,7 +942,7 @@ FloodingBehaviour GetFloodingBehaviour(TileIndex tile) case MP_RAILWAY: if (GetRailGroundType(tile) == RAIL_GROUND_WATER) { - return (IsSlopeWithOneCornerRaised(GetTileSlope(tile, NULL)) ? FLOOD_ACTIVE : FLOOD_DRYUP); + return (IsSlopeWithOneCornerRaised(GetTilePixelSlope(tile, NULL)) ? FLOOD_ACTIVE : FLOOD_DRYUP); } return FLOOD_NONE; @@ -965,7 +965,7 @@ void DoFloodTile(TileIndex target) Backup cur_company(_current_company, OWNER_WATER, FILE_LINE); - Slope tileh = GetTileSlope(target, NULL); + Slope tileh = GetTilePixelSlope(target, NULL); if (tileh != SLOPE_FLAT) { /* make coast.. */ switch (GetTileType(target)) { @@ -1080,7 +1080,7 @@ void TileLoop_Water(TileIndex tile) if (IsTileType(dest, MP_WATER)) continue; uint z_dest; - Slope slope_dest = GetFoundationSlope(dest, &z_dest) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP; + Slope slope_dest = GetFoundationPixelSlope(dest, &z_dest) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP; if (z_dest > 0) continue; if (!HasBit(_flood_from_dirs[slope_dest], ReverseDir(dir))) continue; @@ -1090,7 +1090,7 @@ void TileLoop_Water(TileIndex tile) break; case FLOOD_DRYUP: { - Slope slope_here = GetFoundationSlope(tile, NULL) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP; + Slope slope_here = GetFoundationPixelSlope(tile, NULL) & ~SLOPE_HALFTILE_MASK & ~SLOPE_STEEP; uint dir; FOR_EACH_SET_BIT(dir, _flood_from_dirs[slope_here]) { TileIndex dest = AddTileIndexDiffCWrap(tile, TileIndexDiffCByDir((Direction)dir)); @@ -1112,7 +1112,7 @@ void ConvertGroundTilesIntoWaterTiles() uint z; for (TileIndex tile = 0; tile < MapSize(); ++tile) { - Slope slope = GetTileSlope(tile, &z); + Slope slope = GetTilePixelSlope(tile, &z); if (IsTileType(tile, MP_CLEAR) && z == 0) { /* Make both water for tiles at level 0 * and make shore, as that looks much better @@ -1133,7 +1133,7 @@ void ConvertGroundTilesIntoWaterTiles() uint dir; FOR_EACH_SET_BIT(dir, _flood_from_dirs[slope & ~SLOPE_STEEP]) { TileIndex dest = TILE_ADD(tile, TileOffsByDir((Direction)dir)); - Slope slope_dest = GetTileSlope(dest, NULL) & ~SLOPE_STEEP; + Slope slope_dest = GetTilePixelSlope(dest, NULL) & ~SLOPE_STEEP; if (slope_dest == SLOPE_FLAT || IsSlopeWithOneCornerRaised(slope_dest)) { MakeShore(tile); break; @@ -1154,8 +1154,8 @@ static TrackStatus GetTileTrackStatus_Water(TileIndex tile, TransportType mode, if (mode != TRANSPORT_WATER) return 0; switch (GetWaterTileType(tile)) { - case WATER_TILE_CLEAR: ts = (GetTileSlope(tile, NULL) == SLOPE_FLAT) ? TRACK_BIT_ALL : TRACK_BIT_NONE; break; - case WATER_TILE_COAST: ts = (TrackBits)coast_tracks[GetTileSlope(tile, NULL) & 0xF]; break; + case WATER_TILE_CLEAR: ts = (GetTilePixelSlope(tile, NULL) == SLOPE_FLAT) ? TRACK_BIT_ALL : TRACK_BIT_NONE; break; + case WATER_TILE_COAST: ts = (TrackBits)coast_tracks[GetTilePixelSlope(tile, NULL) & 0xF]; break; case WATER_TILE_LOCK: ts = DiagDirToDiagTrackBits(GetLockDirection(tile)); break; case WATER_TILE_DEPOT: ts = AxisToTrackBits(GetShipDepotAxis(tile)); break; default: return 0; @@ -1213,7 +1213,7 @@ static CommandCost TerraformTile_Water(TileIndex tile, DoCommandFlag flags, uint extern const TileTypeProcs _tile_type_water_procs = { DrawTile_Water, // draw_tile_proc - GetSlopeZ_Water, // get_slope_z_proc + GetSlopePixelZ_Water, // get_slope_z_proc ClearTile_Water, // clear_tile_proc NULL, // add_accepted_cargo_proc GetTileDesc_Water, // get_tile_desc_proc diff --git a/src/waypoint_cmd.cpp b/src/waypoint_cmd.cpp index 8d54921783..51d1928027 100644 --- a/src/waypoint_cmd.cpp +++ b/src/waypoint_cmd.cpp @@ -124,7 +124,7 @@ static CommandCost IsValidTileForWaypoint(TileIndex tile, Axis axis, StationID * if (ret.Succeeded()) ret = EnsureNoVehicleOnGround(tile); if (ret.Failed()) return ret; - Slope tileh = GetTileSlope(tile, NULL); + Slope tileh = GetTilePixelSlope(tile, NULL); if (tileh != SLOPE_FLAT && (!_settings_game.construction.build_on_slopes || IsSteepSlope(tileh) || !(tileh & (0x3 << axis)) || !(tileh & ~(0x3 << axis)))) { return_cmd_error(STR_ERROR_FLAT_LAND_REQUIRED); @@ -285,7 +285,7 @@ CommandCost CmdBuildBuoy(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 if (tile == 0 || !HasTileWaterGround(tile)) return_cmd_error(STR_ERROR_SITE_UNSUITABLE); if (MayHaveBridgeAbove(tile) && IsBridgeAbove(tile)) return_cmd_error(STR_ERROR_MUST_DEMOLISH_BRIDGE_FIRST); - if (GetTileSlope(tile, NULL) != SLOPE_FLAT) return_cmd_error(STR_ERROR_SITE_UNSUITABLE); + if (GetTilePixelSlope(tile, NULL) != SLOPE_FLAT) return_cmd_error(STR_ERROR_SITE_UNSUITABLE); /* Check if there is an already existing, deleted, waypoint close to us that we can reuse. */ Waypoint *wp = FindDeletedWaypointCloseTo(tile, STR_SV_STNAME_BUOY, OWNER_NONE);