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
commitc18791022e065a9c124f97f88262cc0937676fcc (patch)
tree2e1b59837697342ac34e6e1e732640cb70e1dc10
parent5871a45b20443c4f71e9db7279798475996aa3ae (diff)
downloadopenttd-c18791022e065a9c124f97f88262cc0937676fcc.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)