Implement a picker to select a boat or horse when editing a special node

This commit is contained in:
2025-02-22 22:18:35 -05:00
committed by Celtic Minstrel
parent 8ab663b620
commit 36dc44ad1c
5 changed files with 28 additions and 8 deletions

View File

@@ -261,7 +261,7 @@ Second part of message
Unused
Unused
Unused
Horse to set (0 .. 29)
Horse to set
Unused
Unused
Owned by party?
@@ -278,7 +278,7 @@ Second part of message
Unused
Unused
Unused
Boat to set (0 .. 29)
Boat to set
Unused
Unused
Owned by party?

View File

@@ -116,10 +116,10 @@ namespace {
.ex2b(STRT_CMP)
.ex2c(eSpecPicker::NODE);
node_properties_t S_BOAT = node_builder_t(eSpecType::IF_IN_BOAT)
.ex1b(eSpecPicker::BOAT)
.ex1b(STRT_BOAT)
.ex1c(eSpecPicker::NODE);
node_properties_t S_HORSE = node_builder_t(eSpecType::IF_ON_HORSE)
.ex1b(eSpecPicker::HORSE)
.ex1b(STRT_HORSE)
.ex1c(eSpecPicker::NODE);
node_properties_t S_QUEST = node_builder_t(eSpecType::IF_QUEST)
.ex1a(STRT_QUEST)

View File

@@ -58,11 +58,11 @@ namespace{
.ex1b(eSpecPicker::TOGGLE);
node_properties_t S_HORSE_OWN = node_builder_t(eSpecType::CHANGE_HORSE_OWNER)
.msg()
.ex1a(eSpecPicker::HORSE)
.ex1a(STRT_HORSE)
.ex2a(eSpecPicker::TOGGLE);
node_properties_t S_BOAT_OWN = node_builder_t(eSpecType::CHANGE_BOAT_OWNER)
.msg()
.ex1a(eSpecPicker::BOAT)
.ex1a(STRT_BOAT)
.ex2a(eSpecPicker::TOGGLE);
node_properties_t S_TOWN_VIS = node_builder_t(eSpecType::SET_TOWN_VISIBILITY)
.msg()

View File

@@ -146,7 +146,7 @@ enum eStrType {
STRT_DEBUG_PRINT, STRT_TARG_TYPE, STRT_TARG_MODE,
STRT_ID_MODE, STRT_CURSE_MODE, STRT_EQUIP_MODE,
STRT_CMP_MODE, STRT_PATH, STRT_SPELL_PAT_MODE,
STRT_LABEL_ALIGN,
STRT_LABEL_ALIGN, STRT_HORSE, STRT_BOAT,
};
enum class eSpecPicker {
@@ -156,7 +156,7 @@ enum class eSpecPicker {
FIELD, DAMAGE_TYPE, EXPLOSION,
STATUS, STATUS_PARTY,
SDF, LOCATION, RECTANGLE, TOGGLE,
HORSE, BOAT, EVENT, ITEM_CLASS,
EVENT, ITEM_CLASS,
POINTER,
};

View File

@@ -475,6 +475,24 @@ short choose_text(eStrType list, unsigned short cur_choice, cDialog* parent, std
case STRT_LABEL_ALIGN:
strings = {"Align Top", "Align Centre"};
break;
case STRT_BOAT:
case STRT_HORSE:
for(cVehicle& vehicle : (list == STRT_BOAT ? scenario.boats : scenario.horses)) {
if(!vehicle.name.empty()) strings.push_back(vehicle.name);
else {
std::string base = list == STRT_BOAT ? "Unnamed boat in " : "Unnamed horse in";
std::ostringstream sout;
sout << "Unnamed ";
if(list == STRT_BOAT) sout << "boat"; else sout << "horse";
if(vehicle.which_town == 200) {
sout << " outdoors @ " << vehicle.sector;
} else {
sout << " in town " << vehicle.which_town;
}
strings.push_back(sout.str());
}
}
break;
}
if(cur_choice < 0 || cur_choice >= strings.size())
cur_choice = -1;
@@ -978,6 +996,8 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t&
case STRT_SPELL_PAT_MODE: title = "What kind of booms?"; break;
case STRT_LABEL_ALIGN: title = "Choose vertical alignment:"; break;
case STRT_SECTOR: title = "Which sector?"; break;
case STRT_BOAT: title = "Which boat?"; break;
case STRT_HORSE: title = "Which horse?"; break;
default: title = "Title not set for this string type!!!"; break;
}
if(fcn.str_type == STRT_SECTOR && fcn.continuation == eSpecField::NONE) {