Import extra large maps patch.

http://www.tt-forums.net/viewtopic.php?f=33&t=33137
This commit is contained in:
patch-import
2015-09-11 19:53:02 +01:00
committed by Jonathan G Rennison
parent 2816a65365
commit 7d2b4bd3ea
6 changed files with 105 additions and 19 deletions

View File

@@ -37,17 +37,19 @@ TileExtended *_me = NULL; ///< Extended Tiles of the map
*/
void AllocateMap(uint size_x, uint size_y)
{
DEBUG(map, 2, "Min/max map size %d/%d, max map tiles %d", MIN_MAP_SIZE, MAX_MAP_SIZE, MAX_MAP_TILES);
DEBUG(map, 1, "Allocating map of size %dx%d", size_x, size_y);
/* Make sure that the map size is within the limits and that
* size of both axes is a power of 2. */
if (!IsInsideMM(size_x, MIN_MAP_SIZE, MAX_MAP_SIZE + 1) ||
!IsInsideMM(size_y, MIN_MAP_SIZE, MAX_MAP_SIZE + 1) ||
if (size_x * size_y > MAX_MAP_TILES ||
size_x < MIN_MAP_SIZE ||
size_y < MIN_MAP_SIZE ||
(size_x & (size_x - 1)) != 0 ||
(size_y & (size_y - 1)) != 0) {
error("Invalid map size");
}
DEBUG(map, 1, "Allocating map of size %dx%d", size_x, size_y);
_map_log_x = FindFirstBit(size_x);
_map_log_y = FindFirstBit(size_y);
_map_size_x = size_x;