#include "field_of_view.h" /* build_fov_map(), update_map_memory() */
#include "hardcoded_strings.h" /* s */
#include "init.h" /* remake_world() */
-#include "map.h" /* remake_map() */
+#include "map.h" /* init_empty_map(), remake_map() */
#include "thing_actions.h" /* ThingAction, actor_wait(), actor_move(),
* actor_use(), actor_pickup(), actor_drop()
*/
extern uint8_t parse_god_command_2arg(char * tok0, char * tok1, char * tok2)
{
- if (!t && !strcmp(tok0, s[S_CMD_T_MEMMAP]))
+ if (!t && ( !strcmp(tok0, s[S_CMD_T_MEMMAP])
+ || !strcmp(tok0, s[S_CMD_T_MEMDEPTHMAP])))
{
return err_line(1, "No thing defined to manipulate yet.");
}
- if (!strcmp(tok0, s[S_CMD_T_MEMMAP]))
+ if (!strcmp(tok0,s[S_CMD_T_MEMMAP]) || !strcmp(tok0,s[S_CMD_T_MEMDEPTHMAP]))
{
uint8_t y = atoi(tok1);
if (parsetest_int(tok1, '8') || y >= world.map.length)
{
return err_line(1, "Map line length is unequal map width.");
}
- if (!t->mem_map)
+ if (!strcmp(tok0,s[S_CMD_T_MEMMAP]))
{
- uint32_t map_size = world.map.length * world.map.length;
- t->mem_map = try_malloc(map_size, __func__);
- memset(t->mem_map, ' ', map_size);
+ if (!t->mem_map)
+ {
+ init_empty_map(&(t->mem_map));
+ }
+ memcpy(t->mem_map + y * world.map.length, tok2, world.map.length);
+ }
+ else
+ {
+ if (!t->mem_depth_map)
+ {
+ init_empty_map(&(t->mem_depth_map));
+ }
+ memcpy(t->mem_depth_map+y*world.map.length, tok2, world.map.length);
}
- memcpy(t->mem_map + y * world.map.length, tok2, world.map.length);
}
else
{