need slightly different townperson picker for relocate node

This commit is contained in:
2025-09-04 14:25:06 -05:00
parent effab6eecb
commit 02555ede88
3 changed files with 16 additions and 2 deletions

View File

@@ -150,7 +150,7 @@ namespace {
node_properties_t S_WARP = node_builder_t(eSpecType::TOWN_RELOCATE_CREATURE)
.msg()
.loc(eSpecField::EX1A, eSpecField::EX1B, eLocType::ACTIVE_TOWN)
.ex2a(eSpecPicker::TOWNPERSON)
.ex2a(eSpecPicker::TOWNPERSON_100)
.ex2b(STRT_POS_MODE);
node_properties_t S_LABEL = node_builder_t(eSpecType::TOWN_PLACE_LABEL)
.msg1(eSpecPicker::MSG_SINGLE)

View File

@@ -236,7 +236,8 @@ enum class eSpecPicker {
STATUS, STATUS_PARTY,
SDF, LOCATION, RECTANGLE, TOGGLE,
EVENT, ITEM_CLASS, QUEST, JOB_BOARD,
POINTER, SPELL_PATTERN, TOWNPERSON
POINTER, SPELL_PATTERN, TOWNPERSON,
TOWNPERSON_100
};
enum class eLocType {

View File

@@ -786,6 +786,7 @@ static void setup_node_field(cDialog& me, std::string field, short value, const
me[toggle].show();
dynamic_cast<cLed&>(me[toggle]).setState(value > 0 ? eLedState::led_red : eLedState::led_off);
break;
// Townperson starting from 0 with negative indices like python
case eSpecPicker::TOWNPERSON:
me[button].hide();
me[toggle].show();
@@ -793,6 +794,11 @@ static void setup_node_field(cDialog& me, std::string field, short value, const
me[toggle].setText("Relative to end");
me[button2].show();
break;
// Townperson numbered starting from 100, no negative indices allowed
case eSpecPicker::TOWNPERSON_100:
me[button].show();
me[toggle].hide();
break;
default:
me[button].show();
me[button2].hide();
@@ -1740,6 +1746,13 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t&
dynamic_cast<cLed&>(me[item_hit]).setState(store < 0 ? eLedState::led_red : eLedState::led_off);
}
break;
case eSpecPicker::TOWNPERSON_100:
if(town->creatures.empty()){
showWarning("There are no creatures in this town to choose from!");
break;
}
store = 100 + choose_townperson(val - 100, &me);
break;
case eSpecPicker::NONE: return false;
}
me[field].setTextToNum(store);