There are two remaining MAP_MAX_WIDTH * MAP_MAX_HEIGHT arrays: in
settlers.c.
These present problems when increasing MAP_MAX_WIDTH and
MAP_MAX_HEIGHT. They also break under gen-topologies. And of
course they waste memory in general.
The attached patch replaces them with dynamic arrays, as is used
everywhere else. Autogames are identical and slightly faster
(probably because of the direct memset to territory).
And I say that this will be slower that current code.
current we have static double array (
static nearness territory[MAP_MAX_WIDTH][MAP_MAX_HEIGHT]
and any access from map position is simple , just call territory[x1]
[y1] or minimap[x1][y1].
when we make this change we must made conversion from (x1,y1) -> index
each time when we call TERRITORY(x1, y1) or MINIMAP(x1, y1)
this is make by calling
#define TERRITORY(map_x, map_y) territory[map_pos_to_index(map_x, map_y)]
#define MINIMAP(map_x, map_y) minimap[map_pos_to_index(map_x, map_y)]
where #define map_pos_to_index(map_x, map_y) \
(CHECK_MAP_POS((map_x), (map_y)), \
(map_x) + (map_y) * map.xsize)
in this way you add one "*" operation when you want get terrain[][] or
minimap[][]