summaryrefslogtreecommitdiff
path: root/src/map.cpp
diff options
context:
space:
mode:
authormaedhros <maedhros@openttd.org>2007-03-19 11:27:30 +0000
committermaedhros <maedhros@openttd.org>2007-03-19 11:27:30 +0000
commit209101391abfaf901bfc68c83c79bf8c9865b0bb (patch)
tree8ccaccab74c6399452d6ff3f09d5c94335516a62 /src/map.cpp
parent3d3d8d7c47f3fb98abeefe943f7c94f4485f3dec (diff)
downloadopenttd-209101391abfaf901bfc68c83c79bf8c9865b0bb.tar.xz
(svn r9315) -Merge: The newhouses branch. With this merge comes almost complete support for
the newhouses grf specs, so all newhouses grfs will be playable in the game. Many thanks to everyone who contributed code and ideas, and all the testers who found things we missed.
Diffstat (limited to 'src/map.cpp')
-rw-r--r--src/map.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/map.cpp b/src/map.cpp
index 4ae44930a..00655a42e 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -22,7 +22,8 @@ uint _map_size_y;
uint _map_tile_mask;
uint _map_size;
-Tile* _m = NULL;
+Tile *_m = NULL;
+TileExtended *_me = NULL;
void AllocateMap(uint size_x, uint size_y)
@@ -44,10 +45,16 @@ void AllocateMap(uint size_x, uint size_y)
_map_tile_mask = _map_size - 1;
free(_m);
+ free(_me);
+
_m = CallocT<Tile>(_map_size);
+ _me = CallocT<TileExtended>(_map_size);
- /* XXX TODO handle memory shortage more gracefully */
- if (_m == NULL) error("Failed to allocate memory for the map");
+ /* XXX @todo handle memory shortage more gracefully
+ * Maybe some attemps could be made to try with smaller maps down to 64x64
+ * Maybe check for available memory before doing the calls, after all, we know how big
+ * the map is */
+ if ((_m == NULL) || (_me == NULL)) error("Failed to allocate memory for the map");
}