Mercurial > hg > openttd
changeset 925:390dab6bc78b draft
(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.
author | dominik <dominik@openttd.org> |
---|---|
date | Fri, 07 Jan 2005 12:33:28 +0000 |
parents | 4fb14df162e1 |
children | b1ef952b19f8 |
files | landscape.c ttd.h |
diffstat | 2 files changed, 6 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/landscape.c +++ b/landscape.c @@ -84,7 +84,7 @@ { 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 @@ 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 @@ 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); }