equal
deleted
inserted
replaced
38 _map_size_y = size_y; |
38 _map_size_y = size_y; |
39 _map_size = size_x * size_y; |
39 _map_size = size_x * size_y; |
40 _map_tile_mask = _map_size - 1; |
40 _map_tile_mask = _map_size - 1; |
41 |
41 |
42 free(_m); |
42 free(_m); |
43 _m = malloc(_map_size * sizeof(*_m)); |
43 _m = calloc(_map_size, sizeof(*_m)); |
44 |
44 |
45 // XXX TODO handle memory shortage more gracefully |
45 // XXX TODO handle memory shortage more gracefully |
46 if (_m == NULL) error("Failed to allocate memory for the map"); |
46 if (_m == NULL) error("Failed to allocate memory for the map"); |
47 } |
47 } |
48 |
48 |