Debug give item: remember the last
This commit is contained in:
@@ -2025,6 +2025,8 @@ void debug_fight_encounter(bool wandering) {
|
||||
set_up_combat();
|
||||
}
|
||||
|
||||
short last_debug_item = 0;
|
||||
|
||||
void debug_give_item() {
|
||||
if(recording){
|
||||
record_action("debug_give_item", "");
|
||||
@@ -2035,8 +2037,9 @@ void debug_give_item() {
|
||||
}
|
||||
// By default, pre-identify debug items
|
||||
bool ident = true;
|
||||
int i = get_num_response(0, univ.scenario.scen_items.size()-1, "Which item?", item_names, -1, "identified", &ident);
|
||||
int i = get_num_response(0, univ.scenario.scen_items.size()-1, "Which item?", item_names, -1, last_debug_item, "identified", &ident);
|
||||
if(i == -1) return;
|
||||
last_debug_item = i;
|
||||
bool was_ident = univ.scenario.scen_items[i].ident;
|
||||
univ.scenario.scen_items[i].ident = ident;
|
||||
|
||||
|
@@ -868,7 +868,7 @@ std::string get_text_response(std::string prompt, pic_num_t pic) {
|
||||
return result;
|
||||
}
|
||||
|
||||
short get_num_response(short min, short max, std::string prompt, std::vector<std::string> choice_names, boost::optional<short> cancel_value, std::string extra_led, bool* led_output) {
|
||||
short get_num_response(short min, short max, std::string prompt, std::vector<std::string> choice_names, boost::optional<short> cancel_value, short initial_value, std::string extra_led, bool* led_output) {
|
||||
std::ostringstream sout;
|
||||
sout << prompt;
|
||||
|
||||
@@ -887,7 +887,7 @@ short get_num_response(short min, short max, std::string prompt, std::vector<std
|
||||
|
||||
sout << " (" << min << '-' << max << ')';
|
||||
numPanel["prompt"].setText(sout.str());
|
||||
numPanel["number"].setTextToNum(0);
|
||||
numPanel["number"].setTextToNum(initial_value);
|
||||
if(!choice_names.empty()){
|
||||
numPanel["choose"].attachClickHandler([&choice_names, &prompt](cDialog& me,std::string,eKeyMod) -> bool {
|
||||
cStringChoice choose_dlg(choice_names, prompt, &me);
|
||||
|
@@ -40,7 +40,7 @@ std::string get_text_response(std::string prompt = "", pic_num_t pic = 16);
|
||||
// Prompt the player for a number, which might be an index in a given list of strings.
|
||||
// Specify cancel_value to show a cancel button, which will return the given value (for example, -1)
|
||||
// Specify extra_led and led_output to show a labeled LED which will assign led_output with its status unless the dialog is canceled
|
||||
short get_num_response(short min, short max, std::string prompt, std::vector<std::string> choice_names = {}, boost::optional<short> cancel_value = boost::none, std::string extra_led = "", bool* led_output = nullptr);
|
||||
short get_num_response(short min, short max, std::string prompt, std::vector<std::string> choice_names = {}, boost::optional<short> cancel_value = boost::none, short initial_value = 0, std::string extra_led = "", bool* led_output = nullptr);
|
||||
|
||||
enum class eSelectPC {
|
||||
ANY,
|
||||
|
Reference in New Issue
Block a user