Implement a picker for selecting an item class, using the editable string picker.
Used in special node editing and also item editing.
This commit is contained in:
@@ -280,7 +280,7 @@ party gets some gold. This can be accompanied by one or two messages, if you wis
|
||||
<dl>
|
||||
<dt>Mess1, Mess2:</dt><dd>Standard usage. Note that the messages are only displayed if
|
||||
some items are actually taken away.</dd>
|
||||
<dt>Extra 1a:</dt><dd>The item class to take away. (Range 1 ... 100)</dd>
|
||||
<dt>Extra 1a:</dt><dd>The item class to take away.</dd>
|
||||
<dt>Extra 1b:</dt><dd>The special to jump to if no items are taken. If No Special is
|
||||
specified, the Jump To special is used as usual.</dd>
|
||||
<dt>Extra 2a:</dt><dd>The amount of gold to pay for each item (Range 0 ... 250)</dd>
|
||||
@@ -1249,9 +1249,6 @@ Extra 1b is called.</dd>
|
||||
alchemical recipe.
|
||||
<dl>
|
||||
<dt>Extra 1a, Extra 1b:</dt><dd>The x and y coordinates of the desired spot.</dd>
|
||||
<dt>Extra 2a:</dt><dd>The number of a special item class. If an item with this special
|
||||
item class is sitting on the given space, the special in Extra 2b is called and that item
|
||||
is removed from the game.</dd>
|
||||
<dt>Jump To:</dt><dd>Otherwise (or if the party is outdoors) this special is
|
||||
called.</dd></dd>
|
||||
|
||||
|
@@ -76,7 +76,7 @@
|
||||
<text top='220' left='220' width='137' height='13'>Type flag: (0-1000)</text>
|
||||
<text top='244' left='220' width='141' height='13'>Value: (0-10000)</text>
|
||||
<text top='268' left='220' width='141' height='13'>Weight: (0-250)</text>
|
||||
<text top='292' left='220' width='141' height='13'>Special class: (0-100)</text>
|
||||
<button name='edit-ic' type='tiny' text-size='10' top='292' left='220' width='141' height='13'>Special class:</button>
|
||||
<text name='missile-title' top='220' left='440' width='140' height='16'>Missile type:</text>
|
||||
<field name='missile' top='243' left='463' width='50' height='16'/>
|
||||
<pict name='missile-pic' type='missile' num='3' top='243' left='440'/>
|
||||
|
@@ -312,6 +312,7 @@ subtags:
|
||||
names are used when showing the Pick Sound dialog in various places. The required `id`
|
||||
attribute specifies which sound it applies to.
|
||||
* `<event>` - (max unbounded) Gives a name to a major event flag. These names are shown (and editable) when showing the Pick Event dialog in various places. The required `id` attribute specifies which event.
|
||||
* `<item-class>` - (max unbounded) Gives a name to an item special class. These names are shown (and editable) when showing the Pick Item Class dialog in various places. The required `id` attribute specifies which class.
|
||||
|
||||
Terrain Types
|
||||
-------------
|
||||
|
@@ -373,6 +373,15 @@
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
<xs:element name="item-class" minOccurs="0" maxOccurs="unbounded">
|
||||
<xs:complexType>
|
||||
<xs:simpleContent>
|
||||
<xs:extension base="xs:string">
|
||||
<xs:attribute name="id" use="required" type="xs:integer"/>
|
||||
</xs:extension>
|
||||
</xs:simpleContent>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:sequence>
|
||||
</xs:complexType>
|
||||
<xs:element name="scenario">
|
||||
|
@@ -953,6 +953,12 @@ void readScenarioFromXml(ticpp::Document&& data, cScenario& scenario) {
|
||||
if(evtnum > scenario.evt_names.size())
|
||||
scenario.evt_names.resize(evtnum);
|
||||
edit->GetText(&scenario.evt_names[evtnum - 1], false);
|
||||
} else if(type == "item-class") {
|
||||
int icnum = 0;
|
||||
edit->GetAttribute("id", &icnum);
|
||||
if(icnum > scenario.ic_names.size())
|
||||
scenario.ic_names.resize(icnum);
|
||||
edit->GetText(&scenario.ic_names[icnum - 1], false);
|
||||
} else if(type == "graphics") {
|
||||
static const std::set<ePicType> valid_pictypes = {
|
||||
PIC_TER, PIC_TER_ANIM, PIC_TER_MAP,
|
||||
|
@@ -203,6 +203,7 @@ void swap(cScenario& lhs, cScenario& rhs) {
|
||||
swap(lhs.outdoors, rhs.outdoors);
|
||||
swap(lhs.towns, rhs.towns);
|
||||
swap(lhs.evt_names, rhs.evt_names);
|
||||
swap(lhs.ic_names, rhs.ic_names);
|
||||
}
|
||||
|
||||
cScenario::cItemStorage::cItemStorage() : ter_type(-1), property(0) {
|
||||
|
@@ -101,6 +101,7 @@ public:
|
||||
std::vector<std::string> spec_strs;
|
||||
std::vector<std::string> snd_names;
|
||||
std::vector<std::string> evt_names;
|
||||
std::vector<std::string> ic_names;
|
||||
bool adjust_diff;
|
||||
bool is_legacy;
|
||||
fs::path scen_file; // transient
|
||||
|
@@ -1723,6 +1723,10 @@ static bool edit_item_type_event_filter(cDialog& me, std::string hit, cItem& ite
|
||||
});
|
||||
put_item_info(itemInfo, temp_item, scenario);
|
||||
itemInfo.run();
|
||||
} else if(hit == "edit-ic") {
|
||||
int value = me["class"].getTextAsNum();
|
||||
value = choose_text_editable(scenario.ic_names, value, &me, "Select item class:");
|
||||
me["class"].setTextToNum(value);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -1776,7 +1780,7 @@ bool edit_item_type(short which) {
|
||||
item_dlg["weight"].attachFocusHandler(std::bind(check_range, _1, _2, _3, 0, 250, "Weight"));
|
||||
item_dlg["class"].attachFocusHandler(std::bind(check_range, _1, _2, _3, 0, 100, "Special Class"));
|
||||
item_dlg["variety"].attachFocusHandler(std::bind(change_item_variety, _1, _2, std::ref(item)));
|
||||
item_dlg.attachClickHandlers(std::bind(edit_item_type_event_filter, _1, _2, std::ref(item), std::ref(which)), {"okay", "cancel", "abils", "choosepic", "choosetp", "choosemiss", "desc", "preview"});
|
||||
item_dlg.attachClickHandlers(std::bind(edit_item_type_event_filter, _1, _2, std::ref(item), std::ref(which)), {"okay", "cancel", "abils", "choosepic", "choosetp", "choosemiss", "desc", "preview", "edit-ic"});
|
||||
|
||||
if(scenario.scen_items.size() == 1) {
|
||||
item_dlg["prev"].hide();
|
||||
|
@@ -401,6 +401,13 @@ void writeScenarioToXml(ticpp::Printer&& data, cScenario& scenario) {
|
||||
data.PushText(scenario.evt_names[i]);
|
||||
data.CloseElement("event");
|
||||
}
|
||||
for(int i = 0; i < scenario.ic_names.size(); i++) {
|
||||
if(scenario.ic_names[i].empty()) continue;
|
||||
data.OpenElement("item-class");
|
||||
data.PushAttribute("id", i + 1);
|
||||
data.PushText(scenario.ic_names[i]);
|
||||
data.CloseElement("item-class");
|
||||
}
|
||||
data.CloseElement("editor");
|
||||
data.CloseElement("scenario");
|
||||
}
|
||||
|
@@ -1042,6 +1042,7 @@ static bool edit_spec_enc_value(cDialog& me, std::string item_hit, node_stack_t&
|
||||
case eSpecPicker::STATUS_PARTY: store = choose_status_effect(val, true, &me); break;
|
||||
case eSpecPicker::SOUND: store = choose_sound(val, &me); break;
|
||||
case eSpecPicker::EVENT: store = choose_text_editable(scenario.evt_names, val, &me, "Select an event:"); break;
|
||||
case eSpecPicker::ITEM_CLASS: store = choose_text_editable(scenario.ic_names, val, &me, "Select item class:"); break;
|
||||
case eSpecPicker::NONE: return false;
|
||||
}
|
||||
me[field].setTextToNum(store);
|
||||
|
Reference in New Issue
Block a user