home · contact · privacy
Not very elegant solution to bug of appropriate inventory selection not being saved...
[plomrogue] / src / main.c
index 68b1ebbfae6a88af9a3245e9e7468160b78b1879..4a7b57d1b5190ac6efce8f240587d481e8359888 100644 (file)
@@ -17,7 +17,7 @@
 #include "map_objects.h" /* for structs MapObj, init_map_object_defs(),
                           * build_map_objects(), get_player()
                           */
-#include "map.h" /* for struct Map, init_map(), map_center_object() */
+#include "map.h" /* for struct Map, init_map() */
 #include "misc.h" /* for update_log(), find_passable_pos(), save_game(),
                    * try_calloc(), check_tempfile(), check_xor_files(),
                    * load_interface_conf(), load_game()
@@ -25,7 +25,7 @@
 #include "wincontrol.h" /* get_win_by_id(), get_winconf_by_win() */
 #include "rrand.h" /* for rrand(), rrand_seed() */
 #include "rexit.h" /* for exit_game(), exit_err() */
-#include "command_db.h" /* for init_command_db() */
+#include "command_db.h" /* for init_command_db(), is_command_id_shortdsc() */
 #include "control.h" /* for *_control(), get_available_keycode_to_action() */
 
 
@@ -162,7 +162,10 @@ int main(int argc, char *argv[])
     /* Focus map on player. */
     struct MapObj * player = get_player(&world);
     struct Win * win_map = get_win_by_id(&world, 'm');
-    map_center_object(&map, player, win_map->frame.size);
+    win_map->center = player->pos;
+
+    /* Initialize player's inventory selection index to start position. */
+    world.inventory_select = 0;
 
     /* Replay mode. */
     int key;
@@ -179,6 +182,10 @@ int main(int argc, char *argv[])
                 {
                     break;
                 }
+                if (is_command_id_shortdsc(&world, action, "drop"))
+                {
+                    world.inventory_select = getc(file);
+                }
                 record_control(action, &world);
             }
         }
@@ -198,6 +205,10 @@ int main(int argc, char *argv[])
                 action = getc(file);
                 if (EOF != action)
                 {
+                    if (is_command_id_shortdsc(&world, action, "drop"))
+                    {
+                        world.inventory_select = getc(file);
+                    }
                     record_control(action, &world);
                 }
             }