X-Git-Url: https://plomlompom.com/repos/test.html?a=blobdiff_plain;f=src%2Fserver%2Fgod_commands.c;h=87564043d6836433ba5e2f7ad11a7f74e558493a;hb=eda9c448812827e36b71fa1c3eb76d0fb906b57d;hp=06abcfec87626d6677daa9586db3bf0e35dc8042;hpb=08787351493beb2ad649e94d24eebca0e97192c8;p=plomrogue
diff --git a/src/server/god_commands.c b/src/server/god_commands.c
index 06abcfe..8756404 100644
--- a/src/server/god_commands.c
+++ b/src/server/god_commands.c
@@ -15,15 +15,16 @@
#include "../common/rexit.h" /* exit_trouble() */
#include "../common/try_malloc.h" /* try_malloc() */
#include "cleanup.h" /* unset_cleanup_flag() */
-#include "field_of_view.h" /* build_fov_map() */
+#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()
*/
#include "things.h" /* Thing, ThingType, add_thing(), get_thing(), own_thing(),
- * free_things(), add_thing_to_memory_map(),get_thing_type()
+ * free_things(), add_thing_to_memory_map(),get_thing_type(),
+ * get_player()
*/
#include "world.h" /* world */
@@ -251,6 +252,10 @@ static uint8_t parse_position(char* tok0, char * tok1, struct Thing * t)
if (world.exists && t->lifepoints)
{
build_fov_map(t);
+ if (t == get_player())
+ {
+ update_map_memory(t);
+ }
}
}
return 1;
@@ -374,6 +379,10 @@ static uint8_t parse_world_active(char * tok0, char * tok1)
if (ti->lifepoints)
{
build_fov_map(ti);
+ if (ti == get_player())
+ {
+ update_map_memory(ti);
+ }
}
}
world.exists = 1;
@@ -457,9 +466,7 @@ extern uint8_t parse_god_command_2arg(char * tok0, char * tok1, char * tok2)
}
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);
+ init_empty_map(&(t->mem_map));
}
memcpy(t->mem_map + y * world.map.length, tok2, world.map.length);
}