+
+
+
+extern uint8_t parse_god_command_2arg(char * tok0, char * tok1, char * tok2)
+{
+ if (!t && !strcmp(tok0, s[S_CMD_T_MEMMAP]))
+ {
+ return err_line(1, "No thing defined to manipulate yet.");
+ }
+ if (!strcmp(tok0, s[S_CMD_T_MEMMAP]))
+ {
+ uint8_t y = atoi(tok1);
+ if (parsetest_int(tok1, '8') || y >= world.map.length)
+ {
+ return err_line(1, "Illegal value for map line number.");
+ }
+ if (strlen(tok2) != world.map.length)
+ {
+ return err_line(1, "Map line length is unequal map width.");
+ }
+ if (!t->mem_map)
+ {
+ uint32_t map_size = world.map.length * world.map.length;
+ t->mem_map = try_malloc(map_size, __func__);
+ memset(t->mem_map, ' ', map_size);
+ }
+ memcpy(t->mem_map + y * world.map.length, tok2, world.map.length);
+ }
+ else
+ {
+ return 0;
+ }
+ return 1;
+}
+
+
+
+extern uint8_t parse_god_command_3arg(char * tok0, char * tok1, char * tok2,
+ char * tok3)
+{
+ if (!t && !strcmp(tok0, s[S_CMD_T_MEMTHING]))
+ {
+ return err_line(1, "No thing defined to manipulate yet.");
+ }
+ if (!strcmp(tok0, s[S_CMD_T_MEMTHING]))
+ {
+ uint8_t id = atoi(tok1);
+ uint8_t y = atoi(tok2);
+ uint8_t x = atoi(tok3);
+ if ( parsetest_int(tok1, '8') || !get_thing_type(id)
+ || parsetest_int(tok2, '8') || y >= world.map.length
+ || parsetest_int(tok3, '8') || x >= world.map.length)
+ {
+ return err_line(1, "Illegal value for thing type or position.");
+ }
+ add_thing_to_memory_map(t, id, y, x);
+ }
+ else
+ {
+ return 0;
+ }
+ return 1;
+}