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:
@@ -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