home · contact · privacy
Server: Decouple update_map_memory() and build_fov_map(), thus fix bugs.
[plomrogue] / src / server / god_commands.c
index ebe0d5f91be8955f6f81435c02a9a985efe025a9..a190682edbd1c28efcfed80891b14ba7277a7c71 100644 (file)
@@ -15,7 +15,7 @@
 #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() */
@@ -23,7 +23,8 @@
                             * 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 */
 
@@ -88,7 +89,8 @@ static uint8_t parse_thingtype_manipulation(char * tok0, char * tok1)
     if (!tt &&
         (   !strcmp(tok0, s[S_CMD_TT_CONSUM]) || !strcmp(tok0, s[S_CMD_TT_SYMB])
          || !strcmp(tok0, s[S_CMD_TT_STARTN]) || !strcmp(tok0, s[S_CMD_TT_NAME])
-         || !strcmp(tok0, s[S_CMD_TT_CORPS]) || !strcmp(tok0, s[S_CMD_TT_HP])))
+         || !strcmp(tok0, s[S_CMD_TT_CORPS])  || !strcmp(tok0, s[S_CMD_TT_HP])
+         || !strcmp(tok0, s[S_CMD_TT_PROL])))
     {
         return err_line(1, "No thing type defined to manipulate yet.");
     }
@@ -97,6 +99,7 @@ static uint8_t parse_thingtype_manipulation(char * tok0, char * tok1)
         || parse_val(tok0,tok1,s[S_CMD_TT_HP],'8',(char *) &tt->lifepoints)
         || parse_val(tok0,tok1,s[S_CMD_TT_STARTN],'8',(char *) &tt->start_n)
         || parse_val(tok0,tok1,s[S_CMD_TT_SYMB],'c',(char *) &tt->char_on_map)
+        || parse_val(tok0,tok1,s[S_CMD_TT_PROL],'8',(char *) &tt->proliferate)
         || parse_val(tok0,tok1,s[S_CMD_TT_NAME],'s',(char *) &tt->name));
     else if (parse_val(tok0, tok1, s[S_CMD_TT_CORPS],'8',(char *)&id))
     {
@@ -249,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;
@@ -304,10 +311,6 @@ static uint8_t parse_thing_manipulation_1arg(char * tok0, char * tok1)
         if (!t && !err_line(!world.thing_types, err))
         {
             t = add_thing(id, world.thing_types->id, 0, 0);
-            if (world.exists && t->lifepoints)
-            {
-                build_fov_map(t);
-            }
         }
     }
     else
@@ -376,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;