Expose rechargeable flag in the scenario editor

This commit is contained in:
2024-08-31 01:07:06 -04:00
committed by Celtic Minstrel
parent 11fae6fd1e
commit abdf264372
2 changed files with 8 additions and 0 deletions

View File

@@ -41,6 +41,7 @@
<led name='cursed' rel-anchor='prev' relative='pos-in pos' state='off' top='5' left='0' width='100'>Cursed</led> <led name='cursed' rel-anchor='prev' relative='pos-in pos' state='off' top='5' left='0' width='100'>Cursed</led>
<led name='conceal' rel-anchor='prev' relative='pos-in pos' state='off' top='5' left='0' width='100'>Conceal ability</led> <led name='conceal' rel-anchor='prev' relative='pos-in pos' state='off' top='5' left='0' width='100'>Conceal ability</led>
<led name='no-sell' rel-anchor='prev' relative='pos-in pos' state='off' top='5' left='0' width='100'>Shops won't buy</led> <led name='no-sell' rel-anchor='prev' relative='pos-in pos' state='off' top='5' left='0' width='100'>Shops won't buy</led>
<led name='recharge' rel-anchor='prev' relative='pos-in pos' state='off' top='5' left='0' width='100'>Rechargeable</led>
<text name='type-title' anchor='use-title' relative='pos-in pos' top='56' left='2' width='155' height='42'>Item treasure class: (0 is lowest level of treasure, 4 is highest)</text> <text name='type-title' anchor='use-title' relative='pos-in pos' top='56' left='2' width='155' height='42'>Item treasure class: (0 is lowest level of treasure, 4 is highest)</text>
<group name='treasure'> <group name='treasure'>

View File

@@ -1838,11 +1838,17 @@ static void put_item_abils_in_dlog(cDialog& me, cItem& item, short which) {
me["use-type"].hide(); me["use-type"].hide();
} }
if(item.charges <= 0 || item.type_flag != 0) {
// Only unstackable items with charges can be rechargeable.
me["recharge"].hide();
}
dynamic_cast<cLed&>(me["always-id"]).setState(item.ident ? led_red : led_off); dynamic_cast<cLed&>(me["always-id"]).setState(item.ident ? led_red : led_off);
dynamic_cast<cLed&>(me["magic"]).setState(item.magic ? led_red : led_off); dynamic_cast<cLed&>(me["magic"]).setState(item.magic ? led_red : led_off);
dynamic_cast<cLed&>(me["cursed"]).setState(item.cursed ? led_red : led_off); dynamic_cast<cLed&>(me["cursed"]).setState(item.cursed ? led_red : led_off);
dynamic_cast<cLed&>(me["conceal"]).setState(item.concealed ? led_red : led_off); dynamic_cast<cLed&>(me["conceal"]).setState(item.concealed ? led_red : led_off);
dynamic_cast<cLed&>(me["no-sell"]).setState(item.unsellable ? led_red : led_off); dynamic_cast<cLed&>(me["no-sell"]).setState(item.unsellable ? led_red : led_off);
dynamic_cast<cLed&>(me["recharge"]).setState(item.rechargeable ? led_red : led_off);
} }
static void save_item_abils(cDialog& me, cItem& item) { static void save_item_abils(cDialog& me, cItem& item) {
@@ -1857,6 +1863,7 @@ static void save_item_abils(cDialog& me, cItem& item) {
item.cursed = dynamic_cast<cLed&>(me["cursed"]).getState() != led_off; item.cursed = dynamic_cast<cLed&>(me["cursed"]).getState() != led_off;
item.unsellable = dynamic_cast<cLed&>(me["no-sell"]).getState() != led_off; item.unsellable = dynamic_cast<cLed&>(me["no-sell"]).getState() != led_off;
item.concealed = dynamic_cast<cLed&>(me["conceal"]).getState() != led_off; item.concealed = dynamic_cast<cLed&>(me["conceal"]).getState() != led_off;
item.rechargeable = dynamic_cast<cLed&>(me["recharge"]).getState() != led_off;
} }
static bool edit_item_abil_event_filter(cDialog& me, std::string hit, cItem& item, short which) { static bool edit_item_abil_event_filter(cDialog& me, std::string hit, cItem& item, short which) {