diff options
author | dominik <dominik@openttd.org> | 2005-01-07 12:33:28 +0000 |
---|---|---|
committer | dominik <dominik@openttd.org> | 2005-01-07 12:33:28 +0000 |
commit | f5c33e50733c46cee14e84ade6da0c171d96064b (patch) | |
tree | 75a99043a4533ed6a367b58c7e943342aafb4643 | |
parent | 9a4465f9c0db69b3d9da903b67b678a0ee3a565e (diff) | |
download | openttd-f5c33e50733c46cee14e84ade6da0c171d96064b.tar.xz |
(svn r1413) Fixed a serious memory leak problem. The invisible tiles on the southern border now have the correct tile type (MP_VOID) again. Please note that older maps might still have incorrect border tiles, thus still causing overflows.
-rw-r--r-- | landscape.c | 8 | ||||
-rw-r--r-- | ttd.h | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/landscape.c b/landscape.c index ae0913ebe..0971713e8 100644 --- a/landscape.c +++ b/landscape.c @@ -84,7 +84,7 @@ void FindLandscapeHeightByTile(TileInfo *ti, uint tile) { if (GET_TILE_X(tile) == MapMaxX() || GET_TILE_Y(tile) == MapMaxY()) { ti->tileh = 0; - ti->type = MP_STRANGE; + ti->type = MP_VOID; ti->tile = 0; ti->map5 = 0; ti->z = 0; @@ -108,7 +108,7 @@ void FindLandscapeHeight(TileInfo *ti, uint x, uint y) if (x >= MapMaxX() * 16 - 1 || y >= MapMaxY() * 16 - 1) { ti->tileh = 0; - ti->type = MP_STRANGE; + ti->type = MP_VOID; ti->tile = 0; ti->map5 = 0; ti->z = 0; @@ -495,8 +495,10 @@ void InitializeLandscape() memset(_map_extra_bits, 0, map_size / 4); memset(_map_type_and_height, MP_CLEAR << 4, map_size); + // create void tiles on the border for (i = 0; i != MapMaxY(); i++) - memset(_map_type_and_height + i * MapSizeX(), 0, MapSizeX() - 1); + _map_type_and_height[ i * MapSizeX() + MapMaxY() ] = MP_VOID << 4; + memset(_map_type_and_height + MapMaxY() * MapSizeX(), MP_VOID << 4, MapSizeX()); memset(_map5, 3, map_size); } @@ -91,7 +91,7 @@ enum MapTileTypes { MP_TREES, MP_STATION, MP_WATER, - MP_STRANGE, + MP_VOID, // invisible tiles at the SW and SE border MP_INDUSTRY, MP_TUNNELBRIDGE, MP_UNMOVABLE |