mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r4727) - Backport from trunk (r4688):
Fix: Ensure the map memory is cleared after it is allocated. This fixes random deserts that sometimes occurred.
This commit is contained in:
parent
4021f48c58
commit
2aba4c3354
2
map.c
2
map.c
|
@ -40,7 +40,7 @@ void AllocateMap(uint size_x, uint size_y)
|
||||||
_map_tile_mask = _map_size - 1;
|
_map_tile_mask = _map_size - 1;
|
||||||
|
|
||||||
free(_m);
|
free(_m);
|
||||||
_m = malloc(_map_size * sizeof(*_m));
|
_m = calloc(_map_size, sizeof(*_m));
|
||||||
|
|
||||||
// XXX TODO handle memory shortage more gracefully
|
// XXX TODO handle memory shortage more gracefully
|
||||||
if (_m == NULL) error("Failed to allocate memory for the map");
|
if (_m == NULL) error("Failed to allocate memory for the map");
|
||||||
|
|
Loading…
Reference in New Issue