summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortron <tron@openttd.org>2006-02-24 20:35:37 +0000
committertron <tron@openttd.org>2006-02-24 20:35:37 +0000
commit8d983f1bb7a8b22a5dee088de68ef64275efc5e5 (patch)
tree2e1b59837697342ac34e6e1e732640cb70e1dc10
parentd1076fe9732f6bcc30d92c48c5754c8058e22707 (diff)
downloadopenttd-8d983f1bb7a8b22a5dee088de68ef64275efc5e5.tar.xz
(svn r3667) Fix the cause of an assertion I triggered in r3665
-rw-r--r--landscape.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/landscape.c b/landscape.c
index 8c01aa524..89ce548b2 100644
--- a/landscape.c
+++ b/landscape.c
@@ -427,19 +427,20 @@ void RunTileLoop(void)
void InitializeLandscape(void)
{
- uint map_size;
- uint i;
-
+ uint maxx = MapMaxX();
+ uint maxy = MapMaxY();
+ uint sizex = MapSizeX();
+ uint x;
+ uint y;
- map_size = MapSize();
- for (i = 0; i < map_size; i++) {
- MakeClear(i, CL_GRASS, 3);
- _m[i].extra = 0;
+ for (y = 0; y < maxy; y++) {
+ for (x = 0; x < maxx; x++) {
+ MakeClear(sizex * y + x, CL_GRASS, 3);
+ SetTileHeight(sizex * y + x, 0);
+ }
+ MakeVoid(sizex * y + x);
}
-
- // create void tiles at the border
- for (i = 0; i < MapMaxY(); ++i) MakeVoid(i * MapSizeX() + MapMaxX());
- for (i = 0; i < MapSizeX(); ++i) MakeVoid(MapSizeX() * MapMaxY() + i);
+ for (x = 0; x < sizex; x++) MakeVoid(sizex * y + x);
}
void ConvertGroundTilesIntoWaterTiles(void)