#include "map.h"
#include <stdint.h> /* uint8_t, uint16_t, uint32_t, UINT16_MAX */
+#include <stdlib.h> /* free() */
#include "../common/rexit.h" /* exit_err() */
#include "../common/try_malloc.h" /* try_malloc() */
#include "../common/yx_uint8.h" /* struct yx_uint8 */
-extern void init_map()
+extern void remake_map()
{
- char * f_name = "init_map()";
- world.map.cells = try_malloc(world.map.length * world.map.length, f_name);
+ free(world.map.cells);
+ world.map.cells = try_malloc(world.map.length * world.map.length, __func__);
+ uint32_t store_seed = world.seed;
+ world.seed = world.seed_map;
make_sea();
make_island();
make_trees();
+ world.seed = store_seed;
}
}
return passable;
}
-
-
-
-extern uint16_t yx_to_map_pos(struct yx_uint8 * yx)
-{
- return (yx->y * world.map.length) + yx->x;
-}