summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabda <gabda87@gmail.com>2019-02-09 00:05:25 +0100
committerCharles Pigott <charlespigott@googlemail.com>2019-02-08 23:05:25 +0000
commit37bb2c930828260cd28365c8d96befea096bacd6 (patch)
tree0fe5efa02b36db2a08440c264a1d1a9a0494115f /src
parent5e4f76f2f9ad105f619003657229b3bbd87ba678 (diff)
downloadopenttd-37bb2c930828260cd28365c8d96befea096bacd6.tar.xz
Codechange: Make the style of MakeVoid calls uniform (#7192)
Diffstat (limited to 'src')
-rw-r--r--src/genworld.cpp4
-rw-r--r--src/landscape.cpp23
-rw-r--r--src/saveload/afterload.cpp6
-rw-r--r--src/settings.cpp4
-rw-r--r--src/tgp.cpp4
5 files changed, 17 insertions, 24 deletions
diff --git a/src/genworld.cpp b/src/genworld.cpp
index 5cdb129b9..25d6a7bd9 100644
--- a/src/genworld.cpp
+++ b/src/genworld.cpp
@@ -120,8 +120,8 @@ static void _GenerateWorld(void *)
/* Make sure the tiles at the north border are void tiles if needed. */
if (_settings_game.construction.freeform_edges) {
- for (uint row = 0; row < MapSizeY(); row++) MakeVoid(TileXY(0, row));
- for (uint col = 0; col < MapSizeX(); col++) MakeVoid(TileXY(col, 0));
+ for (uint x = 0; x < MapSizeX(); x++) MakeVoid(TileXY(x, 0));
+ for (uint y = 0; y < MapSizeY(); y++) MakeVoid(TileXY(0, y));
}
/* Make the map the height of the setting */
diff --git a/src/landscape.cpp b/src/landscape.cpp
index 2f14a69e4..b173709f3 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -841,22 +841,17 @@ void RunTileLoop()
void InitializeLandscape()
{
- uint maxx = MapMaxX();
- uint maxy = MapMaxY();
- uint sizex = MapSizeX();
-
- uint y;
- for (y = _settings_game.construction.freeform_edges ? 1 : 0; y < maxy; y++) {
- uint x;
- for (x = _settings_game.construction.freeform_edges ? 1 : 0; x < maxx; x++) {
- MakeClear(sizex * y + x, CLEAR_GRASS, 3);
- SetTileHeight(sizex * y + x, 0);
- SetTropicZone(sizex * y + x, TROPICZONE_NORMAL);
- ClearBridgeMiddle(sizex * y + x);
+ for (uint y = _settings_game.construction.freeform_edges ? 1 : 0; y < MapMaxY(); y++) {
+ for (uint x = _settings_game.construction.freeform_edges ? 1 : 0; x < MapMaxX(); x++) {
+ MakeClear(TileXY(x, y), CLEAR_GRASS, 3);
+ SetTileHeight(TileXY(x, y), 0);
+ SetTropicZone(TileXY(x, y), TROPICZONE_NORMAL);
+ ClearBridgeMiddle(TileXY(x, y));
}
- MakeVoid(sizex * y + x);
}
- for (uint x = 0; x < sizex; x++) MakeVoid(sizex * y + x);
+
+ for (uint x = 0; x < MapSizeX(); x++) MakeVoid(TileXY(x, MapMaxY()));
+ for (uint y = 0; y < MapSizeY(); y++) MakeVoid(TileXY(MapMaxX(), y));
}
static const byte _genterrain_tbl_1[5] = { 10, 22, 33, 37, 4 };
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index d0b4723c6..0b570966d 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -204,10 +204,8 @@ static void UpdateCurrencies()
*/
static void UpdateVoidTiles()
{
- uint i;
-
- for (i = 0; i < MapMaxY(); ++i) MakeVoid(i * MapSizeX() + MapMaxX());
- for (i = 0; i < MapSizeX(); ++i) MakeVoid(MapSizeX() * MapMaxY() + i);
+ for (uint x = 0; x < MapSizeX(); x++) MakeVoid(TileXY(x, MapMaxY()));
+ for (uint y = 0; y < MapSizeY(); y++) MakeVoid(TileXY(MapMaxX(), y));
}
static inline RailType UpdateRailType(RailType rt, RailType min)
diff --git a/src/settings.cpp b/src/settings.cpp
index 41d3e2809..b93f4d706 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -1222,8 +1222,8 @@ static bool CheckFreeformEdges(int32 p1)
return false;
}
}
- for (uint i = 0; i < MapSizeX(); i++) MakeVoid(TileXY(i, 0));
- for (uint i = 0; i < MapSizeY(); i++) MakeVoid(TileXY(0, i));
+ for (uint x = 0; x < MapSizeX(); x++) MakeVoid(TileXY(x, 0));
+ for (uint y = 0; y < MapSizeY(); y++) MakeVoid(TileXY(0, y));
} else {
for (uint i = 0; i < MapMaxX(); i++) {
if (TileHeight(TileXY(i, 1)) != 0) {
diff --git a/src/tgp.cpp b/src/tgp.cpp
index 02621f127..4dbb79aa8 100644
--- a/src/tgp.cpp
+++ b/src/tgp.cpp
@@ -995,8 +995,8 @@ void GenerateTerrainPerlin()
/* First make sure the tiles at the north border are void tiles if needed. */
if (_settings_game.construction.freeform_edges) {
- for (int y = 0; y < _height_map.size_y - 1; y++) MakeVoid(_height_map.size_x * y);
- for (int x = 0; x < _height_map.size_x; x++) MakeVoid(x);
+ for (uint x = 0; x < MapSizeX(); x++) MakeVoid(TileXY(x, 0));
+ for (uint y = 0; y < MapSizeY(); y++) MakeVoid(TileXY(0, y));
}
int max_height = H2I(TGPGetMaxHeight());