summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/clear_cmd.cpp4
-rw-r--r--src/disaster_vehicle.cpp8
-rw-r--r--src/industry_cmd.cpp4
-rw-r--r--src/landscape.cpp2
-rw-r--r--src/object_cmd.cpp4
-rw-r--r--src/town_cmd.cpp2
-rw-r--r--src/tree_cmd.cpp10
7 files changed, 17 insertions, 17 deletions
diff --git a/src/clear_cmd.cpp b/src/clear_cmd.cpp
index 98a53b7ba..e532fa529 100644
--- a/src/clear_cmd.cpp
+++ b/src/clear_cmd.cpp
@@ -346,7 +346,7 @@ void GenerateClearTile()
SetGeneratingWorldProgress(GWP_ROUGH_ROCKY, gi + i);
do {
IncreaseGeneratingWorldProgress(GWP_ROUGH_ROCKY);
- tile = RandomTile();
+ tile = TopTile(RandomTile());
if (IsTileType(tile, MP_CLEAR) && !IsClearGround(tile, CLEAR_DESERT)) SetClearGroundDensity(tile, CLEAR_ROUGH, 3);
} while (--i);
@@ -354,7 +354,7 @@ void GenerateClearTile()
i = gi;
do {
uint32 r = Random();
- tile = RandomTileSeed(r);
+ tile = TopTile(RandomTileSeed(r));
IncreaseGeneratingWorldProgress(GWP_ROUGH_ROCKY);
if (IsTileType(tile, MP_CLEAR) && !IsClearGround(tile, CLEAR_DESERT)) {
diff --git a/src/disaster_vehicle.cpp b/src/disaster_vehicle.cpp
index 668a1caea..d339e898b 100644
--- a/src/disaster_vehicle.cpp
+++ b/src/disaster_vehicle.cpp
@@ -326,7 +326,7 @@ static bool DisasterTick_Ufo(DisasterVehicle *v)
return true;
}
if (++v->age < 6) {
- v->dest_tile = RandomTile();
+ v->dest_tile = TopTile(RandomTile());
return true;
}
v->current_order.SetDestination(1);
@@ -573,12 +573,12 @@ static bool DisasterTick_Big_Ufo(DisasterVehicle *v)
}
if (++v->age < 6) {
- v->dest_tile = RandomTile();
+ v->dest_tile = TopTile(RandomTile());
return true;
}
v->current_order.SetDestination(1);
- TileIndex tile_org = RandomTile();
+ TileIndex tile_org = TopTile(RandomTile());
TileIndex tile = tile_org;
do {
if (IsPlainRailTile(tile) &&
@@ -959,7 +959,7 @@ void ReleaseDisastersTargetingVehicle(VehicleID vehicle)
if (v->current_order.GetDestination() != 0 && v->dest_tile == vehicle) {
/* Revert to target-searching */
v->current_order.SetDestination(0);
- v->dest_tile = RandomTile();
+ v->dest_tile = TopTile(RandomTile());
GetAircraftFlightLevelBounds(v, &v->z_pos, nullptr);
v->age = 0;
}
diff --git a/src/industry_cmd.cpp b/src/industry_cmd.cpp
index 8e37724a2..a18fc64da 100644
--- a/src/industry_cmd.cpp
+++ b/src/industry_cmd.cpp
@@ -2024,7 +2024,7 @@ CommandCost CmdBuildIndustry(DoCommandFlag flags, TileIndex tile, IndustryType i
/* We should not have more than one Random() in a function call
* because parameter evaluation order is not guaranteed in the c++ standard
*/
- tile = RandomTile();
+ tile = TopTile(RandomTile());
/* Start with a random layout */
size_t layout = RandomRange((uint32)num_layouts);
/* Check now each layout, starting with the random one */
@@ -2221,7 +2221,7 @@ static Industry *PlaceIndustry(IndustryType type, IndustryAvailabilityCallType c
{
uint tries = try_hard ? 10000u : 2000u;
for (; tries > 0; tries--) {
- Industry *ind = CreateNewIndustry(RandomTile(), type, creation_type);
+ Industry *ind = CreateNewIndustry(TopTile(RandomTile()), type, creation_type);
if (ind != nullptr) return ind;
}
return nullptr;
diff --git a/src/landscape.cpp b/src/landscape.cpp
index ac9040e16..04896421b 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -1283,7 +1283,7 @@ static void CreateRivers()
for (; wells != 0; wells--) {
IncreaseGeneratingWorldProgress(GWP_RIVER);
for (int tries = 0; tries < 128; tries++) {
- TileIndex t = RandomTile();
+ TileIndex t = TopTile(RandomTile());
if (!CircularTileSearch(&t, 8, FindSpring, nullptr)) continue;
if (FlowRiver(t, t)) break;
}
diff --git a/src/object_cmd.cpp b/src/object_cmd.cpp
index b6ea0b408..75f57585a 100644
--- a/src/object_cmd.cpp
+++ b/src/object_cmd.cpp
@@ -710,7 +710,7 @@ static bool TryBuildLightHouse()
*/
static bool TryBuildTransmitter()
{
- TileIndex tile = RandomTile();
+ TileIndex tile = TopTile(RandomTile());
int h;
if (IsTileType(tile, MP_CLEAR) && IsTileFlat(tile, &h) && h >= 4 && !IsBridgeAbove(tile)) {
TileIndex t = tile;
@@ -774,7 +774,7 @@ void GenerateObjects()
default:
uint8 view = RandomRange(spec->views);
- if (CmdBuildObject(DC_EXEC | DC_AUTO | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, RandomTile(), i, view).Succeeded()) amount--;
+ if (CmdBuildObject(DC_EXEC | DC_AUTO | DC_NO_TEST_TOWN_RATING | DC_NO_MODIFY_TOWN_RATING, TopTile(RandomTile()), i, view).Succeeded()) amount--;
break;
}
}
diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp
index 450582941..ade909a6b 100644
--- a/src/town_cmd.cpp
+++ b/src/town_cmd.cpp
@@ -2156,7 +2156,7 @@ static Town *CreateRandomTown(uint attempts, uint32 townnameparts, TownSize size
do {
/* Generate a tile index not too close from the edge */
- TileIndex tile = AlignTileToGrid(RandomTile(), layout);
+ TileIndex tile = AlignTileToGrid(TopTile(RandomTile()), layout);
/* if we tried to place the town on water, slide it over onto
* the nearest likely-looking spot */
diff --git a/src/tree_cmd.cpp b/src/tree_cmd.cpp
index bd112f31b..d0fe4b157 100644
--- a/src/tree_cmd.cpp
+++ b/src/tree_cmd.cpp
@@ -191,7 +191,7 @@ static void PlaceTree(TileIndex tile, uint32 r)
static void PlaceTreeGroups(uint num_groups)
{
do {
- TileIndex center_tile = RandomTile();
+ TileIndex center_tile = TopTile(RandomTile());
for (uint i = 0; i < DEFAULT_TREE_STEPS; i++) {
uint32 r = Random();
@@ -256,7 +256,7 @@ void PlaceTreesRandomly()
if (_game_mode == GM_EDITOR) i /= EDITOR_TREE_DIV;
do {
uint32 r = Random();
- TileIndex tile = RandomTileSeed(r);
+ TileIndex tile = TopTile(RandomTileSeed(r));
IncreaseGeneratingWorldProgress(GWP_TREE);
@@ -285,7 +285,7 @@ void PlaceTreesRandomly()
do {
uint32 r = Random();
- TileIndex tile = RandomTileSeed(r);
+ TileIndex tile = TopTile(RandomTileSeed(r));
IncreaseGeneratingWorldProgress(GWP_TREE);
@@ -852,7 +852,7 @@ void OnTick_Trees()
/* place a tree at a random rainforest spot */
if (_settings_game.game_creation.landscape == LT_TROPIC) {
for (uint c = ScaleByMapSize(1); c > 0; c--) {
- if ((r = Random(), tile = RandomTileSeed(r), GetTropicZone(tile) == TROPICZONE_RAINFOREST) &&
+ if ((r = Random(), tile = TopTile(RandomTileSeed(r)), GetTropicZone(tile) == TROPICZONE_RAINFOREST) &&
CanPlantTreesOnTile(tile, false) &&
(tree = GetRandomTreeType(tile, GB(r, 24, 8))) != TREE_INVALID) {
PlantTreesOnTile(tile, tree, 0, 0);
@@ -864,7 +864,7 @@ void OnTick_Trees()
/* place a tree at a random spot */
r = Random();
- tile = RandomTileSeed(r);
+ tile = TopTile(RandomTileSeed(r));
if (CanPlantTreesOnTile(tile, false) && (tree = GetRandomTreeType(tile, GB(r, 24, 8))) != TREE_INVALID) {
PlantTreesOnTile(tile, tree, 0, 0);
}