diff --git a/src/game/boe.actions.cpp b/src/game/boe.actions.cpp index ee58baa2..fbff7138 100644 --- a/src/game/boe.actions.cpp +++ b/src/game/boe.actions.cpp @@ -1775,6 +1775,20 @@ void toggle_debug_mode() { print_buf(); } +void debug_give_item() { + if(recording){ + record_action("debug_give_item", ""); + } + int i = get_num_response(0, univ.scenario.scen_items.size()-1, "Which item?"); + int j = univ.scenario.scen_items[i].ident; + univ.scenario.scen_items[i].ident = true; + univ.party.give_item(univ.scenario.scen_items[i], true); + univ.scenario.scen_items[i].ident = j; + print_buf(); + put_item_screen(stat_window); + put_pc_screen(); // In case the item was food or gold +} + bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){ bool are_done = false; location pass_point; // TODO: This isn't needed @@ -2085,14 +2099,7 @@ bool handle_keystroke(const sf::Event& event, cFramerateLimiter& fps_limiter){ case 'I': if(univ.debug_mode) { - int i = get_num_response(0, univ.scenario.scen_items.size()-1, "Which item?"); - int j = univ.scenario.scen_items[i].ident; - univ.scenario.scen_items[i].ident = true; - univ.party.give_item(univ.scenario.scen_items[i], true); - univ.scenario.scen_items[i].ident = j; - print_buf(); - put_item_screen(stat_window); - put_pc_screen(); // In case the item was food or gold + debug_give_item(); } break; diff --git a/src/game/boe.actions.hpp b/src/game/boe.actions.hpp index 2147bd5e..2a12e00a 100644 --- a/src/game/boe.actions.hpp +++ b/src/game/boe.actions.hpp @@ -71,5 +71,6 @@ void handle_use_space_select(bool& need_reprint); void handle_use_space(location destination, bool& did_something, bool& need_redraw); void show_inventory(); void toggle_debug_mode(); +void debug_give_item(); #endif diff --git a/src/game/boe.main.cpp b/src/game/boe.main.cpp index a0a68b62..dce90ecf 100644 --- a/src/game/boe.main.cpp +++ b/src/game/boe.main.cpp @@ -481,6 +481,8 @@ static void replay_next_action() { give_help(help1, help2); }else if(t == "toggle_debug_mode"){ toggle_debug_mode(); + }else if(t == "debug_give_item"){ + debug_give_item(); } // TODO some of these actions shouldn't call advance_time(). They should return