summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-11-04 06:05:11 +0000
committerrubidium <rubidium@openttd.org>2011-11-04 06:05:11 +0000
commit47203dbeb5080a5d24131a61ec12d1d3164bcb42 (patch)
tree1f8a379fa272ec9003c0e6f3691150edff3fd225
parent3f853e7a565fcd5e51f13f1c54079c83f625225b (diff)
downloadopenttd-47203dbeb5080a5d24131a61ec12d1d3164bcb42.tar.xz
(svn r23090) -Codechange: use map accessors instead of directly accessing the map (mhl)
-rw-r--r--src/landscape.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/landscape.cpp b/src/landscape.cpp
index a4573a133..ec4b9f7a6 100644
--- a/src/landscape.cpp
+++ b/src/landscape.cpp
@@ -813,16 +813,16 @@ static void GenerateTerrain(int type, uint flag)
if (x + w >= MapMaxX() - 1) return;
if (y + h >= MapMaxY() - 1) return;
- Tile *tile = &_m[TileXY(x, y)];
+ TileIndex tile = TileXY(x, y);
switch (direction) {
default: NOT_REACHED();
case DIAGDIR_NE:
do {
- Tile *tile_cur = tile;
+ TileIndex tile_cur = tile;
for (uint w_cur = w; w_cur != 0; --w_cur) {
- if (GB(*p, 0, 4) >= tile_cur->type_height) tile_cur->type_height = GB(*p, 0, 4);
+ if (GB(*p, 0, 4) >= TileHeight(tile_cur)) SetTileHeight(tile_cur, GB(*p, 0, 4));
p++;
tile_cur++;
}
@@ -832,10 +832,10 @@ static void GenerateTerrain(int type, uint flag)
case DIAGDIR_SE:
do {
- Tile *tile_cur = tile;
+ TileIndex tile_cur = tile;
for (uint h_cur = h; h_cur != 0; --h_cur) {
- if (GB(*p, 0, 4) >= tile_cur->type_height) tile_cur->type_height = GB(*p, 0, 4);
+ if (GB(*p, 0, 4) >= TileHeight(tile_cur)) SetTileHeight(tile_cur, GB(*p, 0, 4));
p++;
tile_cur += TileDiffXY(0, 1);
}
@@ -846,10 +846,10 @@ static void GenerateTerrain(int type, uint flag)
case DIAGDIR_SW:
tile += TileDiffXY(w - 1, 0);
do {
- Tile *tile_cur = tile;
+ TileIndex tile_cur = tile;
for (uint w_cur = w; w_cur != 0; --w_cur) {
- if (GB(*p, 0, 4) >= tile_cur->type_height) tile_cur->type_height = GB(*p, 0, 4);
+ if (GB(*p, 0, 4) >= TileHeight(tile_cur)) SetTileHeight(tile_cur, GB(*p, 0, 4));
p++;
tile_cur--;
}
@@ -860,10 +860,10 @@ static void GenerateTerrain(int type, uint flag)
case DIAGDIR_NW:
tile += TileDiffXY(0, h - 1);
do {
- Tile *tile_cur = tile;
+ TileIndex tile_cur = tile;
for (uint h_cur = h; h_cur != 0; --h_cur) {
- if (GB(*p, 0, 4) >= tile_cur->type_height) tile_cur->type_height = GB(*p, 0, 4);
+ if (GB(*p, 0, 4) >= TileHeight(tile_cur)) SetTileHeight(tile_cur, GB(*p, 0, 4));
p++;
tile_cur -= TileDiffXY(0, 1);
}