home · contact · privacy
Unify Map struct common to server and client in src/common/map.h.
[plomrogue] / src / server / init.c
index 2f6428e99c283e7fe192aa3e7399224bf63fd561..d8ae94f753a1fc66ddbd733c99875a12453254a5 100644 (file)
 #include "../common/rexit.h" /* exit_err() */
 #include "../common/try_malloc.h" /* try_malloc() */
 #include "cleanup.h" /* set_cleanup_flag() */
+#include "field_of_view.h" /* build_fov_map() */
 #include "map.h" /* init_map() */
-#include "map_objects.h" /* MapObjDef, free_map_objects(), add_map_objects() */
+#include "map_objects.h" /* MapObj, MapObjDef, free_map_objects(),
+                          * add_map_objects(), get_player()
+                          */
 #include "run.h" /* obey_msg(), io_loop() */
 #include "world.h" /* global world */
 
@@ -89,9 +92,25 @@ extern void remake_world(uint32_t seed)
     struct MapObjDef * mod;
     for (mod = world.map_obj_defs; NULL != mod; mod = mod->next)
     {
-        add_map_objects(mod->id, mod->start_n);
+        if (world.player_type == mod->id)
+        {
+            add_map_objects(mod->id, mod->start_n);
+            break;
+        }
+    }
+    for (mod = world.map_obj_defs; NULL != mod; mod = mod->next)
+    {
+        if (world.player_type != mod->id)
+        {
+            add_map_objects(mod->id, mod->start_n);
+        }
     }
     set_cleanup_flag(CLEANUP_MAP_OBJECTS);
+    struct MapObj * mo;
+    for (mo = world.map_objs; NULL != mo; mo = mo->next)
+    {
+        mo->fov_map = mo->lifepoints ? build_fov_map(mo) : NULL;
+    }
     if (world.turn)
     {
         exit_trouble(unlink(world.path_record), f_name, "unlink()");