Merge branch 'master' into jgrpp

# Conflicts:
#	src/landscape.cpp
#	src/landscape.h
#	src/misc_gui.cpp
#	src/newgrf_commons.cpp
#	src/order_cmd.cpp
#	src/pathfinder/yapf/yapf_base.hpp
#	src/station_cmd.cpp
#	src/tunnelbridge_cmd.cpp
#	src/vehicle.cpp
#	src/water_cmd.cpp
#	src/window.cpp
This commit is contained in:
Jonathan G Rennison
2024-03-09 21:44:36 +00:00
119 changed files with 1359 additions and 1148 deletions

View File

@@ -2528,12 +2528,11 @@ static int GetSlopePixelZ_Road(TileIndex tile, uint x, uint y, bool)
{
if (IsNormalRoad(tile)) {
int z;
Slope tileh = GetTilePixelSlope(tile, &z);
auto [tileh, z] = GetTilePixelSlope(tile);
if (tileh == SLOPE_FLAT) return z;
Foundation f = GetRoadFoundation(tileh, GetAllRoadBits(tile));
z += ApplyPixelFoundationToSlope(f, &tileh);
z += ApplyPixelFoundationToSlope(f, tileh);
return z + GetPartialPixelZ(x & 0xF, y & 0xF, tileh);
} else {
return GetTileMaxPixelZ(tile);
@@ -2577,7 +2576,7 @@ static void TileLoop_Road(TileIndex tile)
/* Flat foundation tiles should look the same as the tiles they visually connect to. */
int tile_z = GetTileZ(tile);
if (tile_z == GetSnowLine()) {
GetFoundationSlope(tile, &tile_z);
std::tie(std::ignore, tile_z) = GetFoundationSlope(tile);
}
if (IsOnSnow(tile) != (tile_z > GetSnowLine())) {
@@ -2608,7 +2607,7 @@ static void TileLoop_Road(TileIndex tile)
if ((t->road_build_months != 0 || Chance16(_settings_game.economy.random_road_reconstruction, 1000)) &&
(DistanceManhattan(t->xy, tile) < 8 || grp != HZB_TOWN_EDGE) &&
IsNormalRoad(tile) && !HasAtMostOneBit(GetAllRoadBits(tile))) {
if (GetFoundationSlope(tile) == SLOPE_FLAT && EnsureNoVehicleOnGround(tile).Succeeded() && Chance16(1, 40)) {
if (std::get<0>(GetFoundationSlope(tile)) == SLOPE_FLAT && EnsureNoVehicleOnGround(tile).Succeeded() && Chance16(1, 40)) {
StartRoadWorks(tile);
if (_settings_client.sound.ambient) SndPlayTileFx(SND_21_ROAD_WORKS, tile);
@@ -2994,12 +2993,11 @@ static CommandCost TerraformTile_Road(TileIndex tile, DoCommandFlag flags, int z
if (CheckRoadSlope(tileh_new, &bits_copy, ROAD_NONE, ROAD_NONE).Succeeded()) {
/* CheckRoadSlope() sometimes changes the road_bits, if it does not agree with them. */
if (bits == bits_copy) {
int z_old;
Slope tileh_old = GetTileSlope(tile, &z_old);
auto [tileh_old, z_old] = GetTileSlopeZ(tile);
/* 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 += ApplyFoundationToSlope(GetRoadFoundation(tileh_old, bits), tileh_old);
z_new += ApplyFoundationToSlope(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]);