home · contact · privacy
Fixed referencing non-tracked map object definitions file.
[plomrogue] / src / main.c
index fcaac80e3556d1b6e0912775a67f7ddfd4f563cc..06156fc5b01f3cd117de54dad1051044d0e79c95 100644 (file)
@@ -7,10 +7,12 @@
 #include <time.h> /* for time() */
 #include <unistd.h> /* for getopt(), optarg */
 #include <stdint.h> /* for uint32_t */
-#include "windows.h" /* for structs WinMeta, Win, init_win_meta(), draw_all_wins()
+#include "windows.h" /* for structs WinMeta, Win, init_win_meta(),
+                      * draw_all_wins()
                       */
-#include "readwrite.h" /* for read_uint32_bigendian](), write_uint32_bigendian(),
-                        * try_fopen(), try_fclose(), try_fclose_unlink_rename()
+#include "readwrite.h" /* for read_uint32_bigendian](),
+                        * write_uint32_bigendian(), try_fopen(), try_fclose(),
+                        * try_fclose_unlink_rename()
                         */
 #include "map_objects.h" /* for structs MapObj Player, init_map_object_defs(),
                           * build_map_objects()
@@ -84,7 +86,7 @@ int main(int argc, char *argv[])
     struct Player player;
     player.hitpoints = 5;
     world.player = &player;
-    init_map_object_defs(&world, "config/defs2");
+    init_map_object_defs(&world, "config/defs");
     set_cleanup_flag(CLEANUP_MAP_OBJECT_DEFS);
     world.map_obj_count = 1;
 
@@ -136,12 +138,12 @@ int main(int argc, char *argv[])
     if (0 == world.turn)
     {
         player.pos = find_passable_pos(world.map);
-        struct MapObj ** ptr;
-        ptr = build_map_objects(&world, &world.map_objs, 1, 1 + rrand() % 27);
-        ptr = build_map_objects(&world, ptr, 2, 1 + rrand() % 9);
-        ptr = build_map_objects(&world, ptr, 3, 1 + rrand() % 3);
-        ptr = build_map_objects(&world, ptr, 4, 1 + rrand() % 3);
-        ptr = build_map_objects(&world, ptr, 5, 1 + rrand() % 3);
+        world.map_objs = NULL;
+        add_map_objects(&world, 1, 1 + rrand() % 27);
+        add_map_objects(&world, 2, 1 + rrand() % 9);
+        add_map_objects(&world, 3, 1 + rrand() % 3);
+        add_map_objects(&world, 4, 1 + rrand() % 3);
+        add_map_objects(&world, 5, 1 + rrand() % 3);
         set_cleanup_flag(CLEANUP_MAP_OBJECTS);
         world.turn = 1;
     }