mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 11:03:00 +01:00
Provide define for maximum map edge size
This commit is contained in:
committed by
Michael Steenbeek
parent
852ea898e7
commit
c136dc85d2
@@ -38,7 +38,7 @@
|
||||
|
||||
typedef struct map_backup {
|
||||
rct_map_element map_elements[MAX_MAP_ELEMENTS];
|
||||
rct_map_element *tile_pointers[256 * 256];
|
||||
rct_map_element *tile_pointers[MAX_TILE_MAP_ELEMENT_POINTERS];
|
||||
rct_map_element *next_free_map_element;
|
||||
uint16 map_size_units;
|
||||
uint16 map_size_units_minus_2;
|
||||
|
||||
@@ -32,15 +32,12 @@
|
||||
#define MINIMUM_TOOL_SIZE 1
|
||||
#define MAXIMUM_TOOL_SIZE 64
|
||||
|
||||
#define MINIMUM_MAP_SIZE_TECHNICAL 15
|
||||
#define MAXIMUM_MAP_SIZE_TECHNICAL 256
|
||||
#define MINIMUM_MAP_SIZE_PRACTICAL MINIMUM_MAP_SIZE_TECHNICAL-2
|
||||
#define MAXIMUM_MAP_SIZE_PRACTICAL MAXIMUM_MAP_SIZE_TECHNICAL-2
|
||||
|
||||
#define MAP_COLOUR_2(colourA, colourB) ((colourA << 8) | colourB)
|
||||
#define MAP_COLOUR(colour) MAP_COLOUR_2(colour, colour)
|
||||
#define FALLBACK_COLOUR(colour) ((colour << 24) || colour << 16)
|
||||
|
||||
#define MAP_WINDOW_MAP_SIZE (MAXIMUM_MAP_SIZE_TECHNICAL * 2)
|
||||
|
||||
enum {
|
||||
PAGE_PEEPS,
|
||||
PAGE_RIDES
|
||||
@@ -176,7 +173,7 @@ static uint8 _activeTool;
|
||||
static uint32 _currentLine;
|
||||
|
||||
/** rct2: 0x00F1AD68 */
|
||||
static uint8 (*_mapImageData)[512][512];
|
||||
static uint8 (*_mapImageData)[MAP_WINDOW_MAP_SIZE][MAP_WINDOW_MAP_SIZE];
|
||||
|
||||
static sint32 _nextPeepSpawnIndex = 0;
|
||||
|
||||
@@ -888,8 +885,8 @@ static void window_map_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, sint32
|
||||
pushed_g1_element = *g1_element;
|
||||
|
||||
g1_element->offset = (uint8 *) _mapImageData;
|
||||
g1_element->width = 512;
|
||||
g1_element->height = 512;
|
||||
g1_element->width = MAP_WINDOW_MAP_SIZE;
|
||||
g1_element->height = MAP_WINDOW_MAP_SIZE;
|
||||
g1_element->x_offset = -8;
|
||||
g1_element->y_offset = -8;
|
||||
g1_element->flags = 0;
|
||||
@@ -1397,14 +1394,14 @@ static void window_map_set_peep_spawn_tool_down(sint32 x, sint32 y)
|
||||
*/
|
||||
static void map_window_increase_map_size()
|
||||
{
|
||||
if (gMapSize >= 256) {
|
||||
if (gMapSize >= MAXIMUM_MAP_SIZE_TECHNICAL) {
|
||||
window_error_open(STR_CANT_INCREASE_MAP_SIZE_ANY_FURTHER, STR_NONE);
|
||||
return;
|
||||
}
|
||||
|
||||
gMapSize++;
|
||||
gMapSizeUnits = (gMapSize - 1) * 32;
|
||||
gMapSizeMinus2 = (gMapSize * 32) + 254;
|
||||
gMapSizeMinus2 = (gMapSize * 32) + MAXIMUM_MAP_SIZE_PRACTICAL;
|
||||
gMapSizeMaxXY = ((gMapSize - 1) * 32) - 1;
|
||||
map_extend_boundary_surface();
|
||||
window_map_init_map();
|
||||
@@ -1425,7 +1422,7 @@ static void map_window_decrease_map_size()
|
||||
|
||||
gMapSize--;
|
||||
gMapSizeUnits = (gMapSize - 1) * 32;
|
||||
gMapSizeMinus2 = (gMapSize * 32) + 254;
|
||||
gMapSizeMinus2 = (gMapSize * 32) + MAXIMUM_MAP_SIZE_PRACTICAL;
|
||||
gMapSizeMaxXY = ((gMapSize - 1) * 32) - 1;
|
||||
map_remove_out_of_range_elements();
|
||||
window_map_init_map();
|
||||
@@ -1655,8 +1652,8 @@ static void map_window_set_pixels(rct_window *w)
|
||||
uint8 *destination;
|
||||
sint32 x = 0, y = 0, dx = 0, dy = 0;
|
||||
|
||||
sint32 pos = (_currentLine * 511) + 255;
|
||||
rct_xy16 destinationPosition = {.y = pos/512, .x = pos % 512};
|
||||
sint32 pos = (_currentLine * (MAP_WINDOW_MAP_SIZE - 1)) + MAXIMUM_MAP_SIZE_TECHNICAL - 1;
|
||||
rct_xy16 destinationPosition = {.y = pos/MAP_WINDOW_MAP_SIZE, .x = pos % MAP_WINDOW_MAP_SIZE};
|
||||
destination = &(*_mapImageData)[destinationPosition.y][destinationPosition.x];
|
||||
switch (get_current_rotation()) {
|
||||
case 0:
|
||||
@@ -1672,20 +1669,20 @@ static void map_window_set_pixels(rct_window *w)
|
||||
dy = 0;
|
||||
break;
|
||||
case 2:
|
||||
x = (255 - _currentLine) * 32;
|
||||
x = ((MAXIMUM_MAP_SIZE_TECHNICAL - 1) - _currentLine) * 32;
|
||||
y = 8192 - 32;
|
||||
dx = 0;
|
||||
dy = -32;
|
||||
break;
|
||||
case 3:
|
||||
x = 0;
|
||||
y = (255 - _currentLine) * 32;
|
||||
y = ((MAXIMUM_MAP_SIZE_TECHNICAL - 1) - _currentLine) * 32;
|
||||
dx = 32;
|
||||
dy = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
for (sint32 i = 0; i < 256; i++) {
|
||||
for (sint32 i = 0; i < MAXIMUM_MAP_SIZE_TECHNICAL; i++) {
|
||||
if (
|
||||
x > 0 &&
|
||||
y > 0 &&
|
||||
@@ -1711,7 +1708,7 @@ static void map_window_set_pixels(rct_window *w)
|
||||
destination = &(*_mapImageData)[destinationPosition.y][destinationPosition.x];
|
||||
}
|
||||
_currentLine++;
|
||||
if (_currentLine >= 256)
|
||||
if (_currentLine >= MAXIMUM_MAP_SIZE_TECHNICAL)
|
||||
_currentLine = 0;
|
||||
}
|
||||
|
||||
@@ -1719,8 +1716,8 @@ static void map_window_screen_to_map(sint32 screenX, sint32 screenY, sint32 *map
|
||||
{
|
||||
sint32 x, y;
|
||||
|
||||
screenX = ((screenX + 8) - 256) / 2;
|
||||
screenY = ((screenY + 8) ) / 2;
|
||||
screenX = ((screenX + 8) - MAXIMUM_MAP_SIZE_TECHNICAL) / 2;
|
||||
screenY = ((screenY + 8)) / 2;
|
||||
x = (screenY - screenX) * 32;
|
||||
y = (screenX + screenY) * 32;
|
||||
switch (get_current_rotation()) {
|
||||
|
||||
@@ -530,10 +530,6 @@ static const sint32 TabAnimationLoops[WINDOW_MAPGEN_PAGE_COUNT] = {
|
||||
16, 16, 16, 0
|
||||
};
|
||||
|
||||
#define MINIMUM_MAP_SIZE_TECHNICAL 15
|
||||
#define MAXIMUM_MAP_SIZE_TECHNICAL 256
|
||||
#define MINIMUM_MAP_SIZE_PRACTICAL MINIMUM_MAP_SIZE_TECHNICAL-2
|
||||
#define MAXIMUM_MAP_SIZE_PRACTICAL MAXIMUM_MAP_SIZE_TECHNICAL-2
|
||||
#define BASESIZE_MIN 0
|
||||
#define BASESIZE_MAX 60
|
||||
#define WATERLEVEL_MIN 0
|
||||
|
||||
@@ -94,7 +94,7 @@ sint16 gMapSizeMaxXY;
|
||||
sint16 gMapBaseZ;
|
||||
|
||||
#if defined(NO_RCT2)
|
||||
rct_map_element gMapElements[0x30000];
|
||||
rct_map_element gMapElements[MAX_TILE_MAP_ELEMENT_POINTERS * 3];
|
||||
rct_map_element *gMapElementTilePointers[MAX_TILE_MAP_ELEMENT_POINTERS];
|
||||
#else
|
||||
rct_map_element *gMapElements = RCT2_ADDRESS(RCT2_ADDRESS_MAP_ELEMENTS, rct_map_element);
|
||||
@@ -202,13 +202,13 @@ sint32 map_element_iterator_next(map_element_iterator *it)
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (it->x < 255) {
|
||||
if (it->x < (MAXIMUM_MAP_SIZE_TECHNICAL - 1)) {
|
||||
it->x++;
|
||||
it->element = map_get_first_element_at(it->x, it->y);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (it->y < 255) {
|
||||
if (it->y < (MAXIMUM_MAP_SIZE_TECHNICAL - 1)) {
|
||||
it->x = 0;
|
||||
it->y++;
|
||||
it->element = map_get_first_element_at(it->x, it->y);
|
||||
@@ -225,11 +225,11 @@ void map_element_iterator_restart_for_tile(map_element_iterator *it)
|
||||
|
||||
rct_map_element *map_get_first_element_at(sint32 x, sint32 y)
|
||||
{
|
||||
if (x < 0 || y < 0 || x > 255 || y > 255) {
|
||||
if (x < 0 || y < 0 || x > (MAXIMUM_MAP_SIZE_TECHNICAL - 1) || y > (MAXIMUM_MAP_SIZE_TECHNICAL - 1)) {
|
||||
log_error("Trying to access element outside of range");
|
||||
return NULL;
|
||||
}
|
||||
return gMapElementTilePointers[x + y * 256];
|
||||
return gMapElementTilePointers[x + y * MAXIMUM_MAP_SIZE_TECHNICAL];
|
||||
}
|
||||
|
||||
rct_map_element *map_get_nth_element_at(sint32 x, sint32 y, sint32 n)
|
||||
@@ -257,11 +257,11 @@ rct_map_element *map_get_nth_element_at(sint32 x, sint32 y, sint32 n)
|
||||
|
||||
void map_set_tile_elements(sint32 x, sint32 y, rct_map_element *elements)
|
||||
{
|
||||
if (x < 0 || y < 0 || x > 255 || y > 255) {
|
||||
if (x < 0 || y < 0 || x > (MAXIMUM_MAP_SIZE_TECHNICAL - 1) || y > (MAXIMUM_MAP_SIZE_TECHNICAL - 1)) {
|
||||
log_error("Trying to access element outside of range");
|
||||
return;
|
||||
}
|
||||
gMapElementTilePointers[x + y * 256] = elements;
|
||||
gMapElementTilePointers[x + y * MAXIMUM_MAP_SIZE_TECHNICAL] = elements;
|
||||
}
|
||||
|
||||
sint32 map_element_is_last_for_tile(const rct_map_element *element)
|
||||
@@ -439,8 +439,8 @@ void map_count_remaining_land_rights()
|
||||
gLandRemainingOwnershipSales = 0;
|
||||
gLandRemainingConstructionSales = 0;
|
||||
|
||||
for (sint32 x = 0; x <= 255; x++) {
|
||||
for (sint32 y = 0; y <= 255; y++) {
|
||||
for (sint32 x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) {
|
||||
for (sint32 y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) {
|
||||
rct_map_element *element = map_get_surface_element_at(x, y);
|
||||
// Surface elements are sometimes hacked out to save some space for other map elements
|
||||
if (element == NULL) {
|
||||
@@ -472,7 +472,7 @@ void map_strip_ghost_flag_from_elements()
|
||||
rct_map_element *mapElement = gMapElements;
|
||||
do {
|
||||
mapElement->flags &= ~MAP_ELEMENT_FLAG_GHOST;
|
||||
} while (++mapElement < gMapElements + 0x30000);
|
||||
} while (++mapElement < gMapElements + MAX_MAP_ELEMENTS);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -489,8 +489,8 @@ void map_update_tile_pointers()
|
||||
|
||||
rct_map_element *mapElement = gMapElements;
|
||||
rct_map_element **tile = gMapElementTilePointers;
|
||||
for (y = 0; y < 256; y++) {
|
||||
for (x = 0; x < 256; x++) {
|
||||
for (y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) {
|
||||
for (x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) {
|
||||
*tile++ = mapElement;
|
||||
while (!map_element_is_last_for_tile(mapElement++));
|
||||
}
|
||||
@@ -783,7 +783,7 @@ sint32 map_height_from_slope(sint32 x, sint32 y, sint32 slope)
|
||||
|
||||
bool map_is_location_valid(sint32 x, sint32 y)
|
||||
{
|
||||
if (x < (256 * 32) && x >= 0 && y < (256 * 32) && y >= 0) {
|
||||
if (x < (MAXIMUM_MAP_SIZE_TECHNICAL * 32) && x >= 0 && y < (MAXIMUM_MAP_SIZE_TECHNICAL * 32) && y >= 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -1197,7 +1197,7 @@ void game_command_set_large_scenery_colour(sint32* eax, sint32* ebx, sint32* ecx
|
||||
baseTile.y = y - baseTile.y;
|
||||
|
||||
for (sint32 i = 0; scenery_entry->large_scenery.tiles[i].x_offset != -1; ++i) {
|
||||
assert(i < 256);
|
||||
assert(i < MAXIMUM_MAP_SIZE_TECHNICAL);
|
||||
|
||||
// Work out the current tile coordinates
|
||||
rct_xyz16 currentTile = {
|
||||
@@ -1337,8 +1337,8 @@ restart_from_beginning:
|
||||
static void map_reset_clear_large_scenery_flag(){
|
||||
rct_map_element* mapElement;
|
||||
// TODO: Improve efficiency of this
|
||||
for (sint32 y = 0; y <= 255; y++) {
|
||||
for (sint32 x = 0; x <= 255; x++) {
|
||||
for (sint32 y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) {
|
||||
for (sint32 x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) {
|
||||
mapElement = map_get_first_element_at(x, y);
|
||||
do {
|
||||
if (map_element_get_type(mapElement) == MAP_ELEMENT_TYPE_SCENERY_MULTIPLE) {
|
||||
@@ -2281,8 +2281,8 @@ static money32 smooth_land(sint32 flags, sint32 centreX, sint32 centreY, sint32
|
||||
// Cap bounds to map
|
||||
mapLeft = max(mapLeft, 32);
|
||||
mapTop = max(mapTop, 32);
|
||||
mapRight = clamp(0, mapRight, 255 * 32);
|
||||
mapBottom = clamp(0, mapBottom, 255 * 32);
|
||||
mapRight = clamp(0, mapRight, (MAXIMUM_MAP_SIZE_TECHNICAL - 1) * 32);
|
||||
mapBottom = clamp(0, mapBottom, (MAXIMUM_MAP_SIZE_TECHNICAL - 1) * 32);
|
||||
|
||||
sint32 commandType;
|
||||
sint32 centreZ = map_element_height(centreX, centreY);
|
||||
@@ -2339,7 +2339,7 @@ static money32 smooth_land(sint32 flags, sint32 centreX, sint32 centreY, sint32
|
||||
|
||||
// Then do the smoothing
|
||||
// The coords go in circles around the selected tile(s)
|
||||
for (; size <= 256; size += 2) {
|
||||
for (; size <= MAXIMUM_MAP_SIZE_TECHNICAL; size += 2) {
|
||||
initialMinZ += 2;
|
||||
sint32 minZ = initialMinZ * 2;
|
||||
x -= 32;
|
||||
@@ -2944,7 +2944,7 @@ void game_command_place_scenery(sint32* eax, sint32* ebx, sint32* ecx, sint32* e
|
||||
|
||||
bool map_is_location_at_edge(sint32 x, sint32 y)
|
||||
{
|
||||
return x < 32 || y < 32 || x >= ((256 - 1) * 32) || y >= ((256 - 1) * 32);
|
||||
return x < 32 || y < 32 || x >= ((MAXIMUM_MAP_SIZE_TECHNICAL - 1) * 32) || y >= ((MAXIMUM_MAP_SIZE_TECHNICAL - 1) * 32);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3322,7 +3322,7 @@ void map_reorganise_elements()
|
||||
{
|
||||
context_setcurrentcursor(CURSOR_ZZZ);
|
||||
|
||||
rct_map_element* new_map_elements = malloc(0x30000 * sizeof(rct_map_element));
|
||||
rct_map_element* new_map_elements = malloc(3 * (MAXIMUM_MAP_SIZE_TECHNICAL * MAXIMUM_MAP_SIZE_TECHNICAL) * sizeof(rct_map_element));
|
||||
rct_map_element* new_elements_pointer = new_map_elements;
|
||||
|
||||
if (new_map_elements == NULL) {
|
||||
@@ -3332,8 +3332,8 @@ void map_reorganise_elements()
|
||||
|
||||
uint32 num_elements;
|
||||
|
||||
for (sint32 y = 0; y < 256; y++) {
|
||||
for (sint32 x = 0; x < 256; x++) {
|
||||
for (sint32 y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) {
|
||||
for (sint32 x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) {
|
||||
rct_map_element *startElement = map_get_first_element_at(x, y);
|
||||
rct_map_element *endElement = startElement;
|
||||
while (!map_element_is_last_for_tile(endElement++));
|
||||
@@ -3346,7 +3346,7 @@ void map_reorganise_elements()
|
||||
|
||||
num_elements = (uint32)(new_elements_pointer - new_map_elements);
|
||||
memcpy(gMapElements, new_map_elements, num_elements * sizeof(rct_map_element));
|
||||
memset(gMapElements + num_elements, 0, (0x30000 - num_elements) * sizeof(rct_map_element));
|
||||
memset(gMapElements + num_elements, 0, (3 * (MAXIMUM_MAP_SIZE_TECHNICAL * MAXIMUM_MAP_SIZE_TECHNICAL) - num_elements) * sizeof(rct_map_element));
|
||||
|
||||
free(new_map_elements);
|
||||
|
||||
@@ -3394,10 +3394,10 @@ rct_map_element *map_element_insert(sint32 x, sint32 y, sint32 z, sint32 flags)
|
||||
}
|
||||
|
||||
newMapElement = gNextFreeMapElement;
|
||||
originalMapElement = gMapElementTilePointers[y * 256 + x];
|
||||
originalMapElement = gMapElementTilePointers[y * MAXIMUM_MAP_SIZE_TECHNICAL + x];
|
||||
|
||||
// Set tile index pointer to point to new element block
|
||||
gMapElementTilePointers[y * 256 + x] = newMapElement;
|
||||
gMapElementTilePointers[y * MAXIMUM_MAP_SIZE_TECHNICAL + x] = newMapElement;
|
||||
|
||||
// Copy all elements that are below the insert height
|
||||
while (z >= originalMapElement->base_height) {
|
||||
@@ -3823,8 +3823,8 @@ void map_remove_out_of_range_elements()
|
||||
{
|
||||
sint32 mapMaxXY = gMapSizeMaxXY;
|
||||
|
||||
for (sint32 y = 0; y < (256 * 32); y += 32) {
|
||||
for (sint32 x = 0; x < (256 * 32); x += 32) {
|
||||
for (sint32 y = 0; y < (MAXIMUM_MAP_SIZE_TECHNICAL * 32); y += 32) {
|
||||
for (sint32 x = 0; x < (MAXIMUM_MAP_SIZE_TECHNICAL * 32); x += 32) {
|
||||
if (x == 0 || y == 0 || x >= mapMaxXY || y >= mapMaxXY) {
|
||||
map_buy_land_rights(x, y, x, y, 1, GAME_COMMAND_FLAG_APPLY);
|
||||
clear_elements_at(x, y);
|
||||
@@ -3843,7 +3843,7 @@ void map_extend_boundary_surface()
|
||||
sint32 x, y, z, slope;
|
||||
|
||||
y = gMapSize - 2;
|
||||
for (x = 0; x < 256; x++) {
|
||||
for (x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) {
|
||||
existingMapElement = map_get_surface_element_at(x, y - 1);
|
||||
newMapElement = map_get_surface_element_at(x, y);
|
||||
|
||||
@@ -3879,7 +3879,7 @@ void map_extend_boundary_surface()
|
||||
}
|
||||
|
||||
x = gMapSize - 2;
|
||||
for (y = 0; y < 256; y++) {
|
||||
for (y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) {
|
||||
existingMapElement = map_get_surface_element_at(x - 1, y);
|
||||
newMapElement = map_get_surface_element_at(x, y);
|
||||
|
||||
@@ -4351,8 +4351,8 @@ bool map_surface_is_blocked(sint16 x, sint16 y){
|
||||
/* Clears all map elements, to be used before generating a new map */
|
||||
void map_clear_all_elements()
|
||||
{
|
||||
for (sint32 y = 0; y < (256 * 32); y += 32) {
|
||||
for (sint32 x = 0; x < (256 * 32); x += 32) {
|
||||
for (sint32 y = 0; y < (MAXIMUM_MAP_SIZE_TECHNICAL * 32); y += 32) {
|
||||
for (sint32 x = 0; x < (MAXIMUM_MAP_SIZE_TECHNICAL * 32); x += 32) {
|
||||
clear_elements_at(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,11 +245,17 @@ enum {
|
||||
#define MAP_ELEMENT_WATER_HEIGHT_MASK 0x1F
|
||||
#define MAP_ELEMENT_SURFACE_TERRAIN_MASK 0xE0
|
||||
|
||||
#define MAP_MINIMUM_X_Y -256
|
||||
|
||||
#define MINIMUM_MAP_SIZE_TECHNICAL 15
|
||||
#define MAXIMUM_MAP_SIZE_TECHNICAL 256
|
||||
#define MINIMUM_MAP_SIZE_PRACTICAL (MINIMUM_MAP_SIZE_TECHNICAL-2)
|
||||
#define MAXIMUM_MAP_SIZE_PRACTICAL (MAXIMUM_MAP_SIZE_TECHNICAL-2)
|
||||
|
||||
#define MAP_MINIMUM_X_Y -MAXIMUM_MAP_SIZE_TECHNICAL
|
||||
#define MAP_LOCATION_NULL ((sint16)(uint16)0x8000)
|
||||
|
||||
#define MAX_MAP_ELEMENTS 196096
|
||||
#define MAX_TILE_MAP_ELEMENT_POINTERS (256 * 256)
|
||||
#define MAX_MAP_ELEMENTS 196096 // 0x30000
|
||||
#define MAX_TILE_MAP_ELEMENT_POINTERS (MAXIMUM_MAP_SIZE_TECHNICAL * MAXIMUM_MAP_SIZE_TECHNICAL)
|
||||
#define MAX_PEEP_SPAWNS 2
|
||||
#define PEEP_SPAWN_UNDEFINED 0xFFFF
|
||||
|
||||
|
||||
@@ -304,7 +304,7 @@ static void mapgen_place_trees()
|
||||
|
||||
sint32 availablePositionsCount = 0;
|
||||
struct { sint32 x; sint32 y; } tmp, *pos, *availablePositions;
|
||||
availablePositions = malloc(256 * 256 * sizeof(tmp));
|
||||
availablePositions = malloc(MAXIMUM_MAP_SIZE_TECHNICAL * MAXIMUM_MAP_SIZE_TECHNICAL * sizeof(tmp));
|
||||
|
||||
// Create list of available tiles
|
||||
for (sint32 y = 1; y < gMapSize - 1; y++) {
|
||||
@@ -843,9 +843,9 @@ bool mapgen_load_heightmap(const utf8 *path)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (width > 254) {
|
||||
if (width > MAXIMUM_MAP_SIZE_PRACTICAL) {
|
||||
window_error_open(STR_HEIGHT_MAP_ERROR, STR_ERROR_HEIHGT_MAP_TOO_BIG);
|
||||
width = height = min(height, 254);
|
||||
width = height = min(height, MAXIMUM_MAP_SIZE_PRACTICAL);
|
||||
}
|
||||
|
||||
// Allocate memory for the height map values, one byte pixel
|
||||
|
||||
Reference in New Issue
Block a user