Debug action: fill active PC's inventory

This commit is contained in:
2025-02-19 12:01:27 -06:00
committed by Celtic Minstrel
parent 23adcac665
commit c7ec0e3a85
5 changed files with 31 additions and 1 deletions

View File

@@ -2015,6 +2015,24 @@ void debug_give_item() {
put_pc_screen(); // In case the item was food or gold
}
void debug_overburden() {
if(recording){
record_action("debug_overburden", "");
}
cPlayer& pc = univ.current_pc();
cItem item(ITEM_DEBUG_HEAVY);
// Give the PC very heavy objects that do nothing:
while(pc.give_item(item, GIVE_ALLOW_OVERLOAD)){}
if(pc.has_space()){
// I don't know why this would ever happen, since the weight is 0, but just in case:
ASB("Debug: failed to fill " + pc.name + "'s inventory.");
}else{
ASB("Debug: filled " + pc.name + "'s inventory.");
}
print_buf();
}
void debug_print_location() {
if(recording){
record_action("debug_print_location", "");
@@ -2390,7 +2408,7 @@ void show_debug_help() {
}
// Non-comprehensive list of unused keys:
// Y chijklnoqvy @#$-_+[]{},.'"`~/\|;:
// chijklnoqvy @#$-_+[]{},.'"`~/\|;:
void init_debug_actions() {
add_debug_action({'B'}, "Leave town", debug_leave_town);
add_debug_action({'C'}, "Get cleaned up (lose negative status effects)", debug_clean_up);
@@ -2401,6 +2419,7 @@ void init_debug_actions() {
add_debug_action({'H'}, "Heal", debug_heal);
// This one was missing from the old help dialog:
add_debug_action({'I'}, "Give item", debug_give_item);
add_debug_action({'Y'}, "Fill PC's inventory", debug_overburden);
// TODO this is not recorded or replayed because the rsrc you pick might not even be packaged
// in the build
add_debug_action({'J'}, "Preview a dialog's layout", preview_dialog_xml);

View File

@@ -86,6 +86,7 @@ void init_debug_actions();
void show_debug_help();
void debug_fight_encounter(bool wandering);
void debug_give_item();
void debug_overburden();
void debug_print_location();
void debug_step_through();
void debug_leave_town();

View File

@@ -784,6 +784,9 @@ static void replay_action(Element& action) {
}else if(t == "debug_give_item"){
debug_give_item();
return;
}else if(t == "debug_overburden"){
debug_overburden();
return;
}else if(t == "debug_print_location"){
debug_print_location();
return;

View File

@@ -334,6 +334,12 @@ cItem::cItem(eItemPreset preset) : cItem() {
name = "Potion";
magic = true;
break;
case ITEM_DEBUG_HEAVY:
variety = eItemType::NON_USE_OBJECT;
full_name = name = "Debug heavy item";
ident = true;
weight = 300;
break;
case ITEM_SPECIAL:
item_level = -1;
full_name = "Call Special Node";

View File

@@ -35,6 +35,7 @@ enum eItemPreset {
ITEM_FOOD,
ITEM_SPELL,
ITEM_POTION,
ITEM_DEBUG_HEAVY,
ITEM_SPECIAL,
ITEM_SHOP,
};