Dialog engine now appends the XML file extension automatically.

- This creates the possibility of changing the file extension later
This commit is contained in:
2014-12-26 23:23:33 -05:00
parent 57a0e728bb
commit d5575ee8fa
22 changed files with 161 additions and 162 deletions

View File

@@ -898,7 +898,7 @@ static void handle_victory() {reload_startup();
draw_startup(0);
menu_activate();
univ.party.scen_name = ""; // should be harmless...
if(cChoiceDlog("congrats-save.xml",{"cancel","save"}).show() == "save"){
if(cChoiceDlog("congrats-save",{"cancel","save"}).show() == "save"){
// TODO: Wait, this shouldn't be a "save as" action, should it? It should save without asking for a location.
fs::path file = nav_put_party();
if(!file.empty()) save_party(file, univ);
@@ -1299,7 +1299,7 @@ bool handle_action(sf::Event event) {
// TODO: Jobs! Or maybe quests!
break;
case 8: // help
cChoiceDlog("help-inventory.xml").show();
cChoiceDlog("help-inventory").show();
break;
default:
handle_switch_pc_items(i, need_redraw);
@@ -1686,9 +1686,9 @@ bool handle_keystroke(sf::Event& event){
give_help(205,6);
break;
}
if(is_out()) cChoiceDlog("help-outdoor.xml").show();
if(is_town()) cChoiceDlog("help-town.xml").show();
if(is_combat()) cChoiceDlog("help-combat.xml").show();
if(is_out()) cChoiceDlog("help-outdoor").show();
if(is_town()) cChoiceDlog("help-town").show();
if(is_combat()) cChoiceDlog("help-combat").show();
break;
case '1': case '2': case '3': case '4': case '5': case '6':
@@ -2554,7 +2554,7 @@ void switch_pc(short which) {
void drop_pc(short which) {
std::string choice;
choice = cChoiceDlog("delete-pc-confirm.xml",{"yes","no"}).show();
choice = cChoiceDlog("delete-pc-confirm",{"yes","no"}).show();
if(choice == "no") {
add_string_to_buf("Delete PC: Cancelled. ");
return;
@@ -2575,7 +2575,7 @@ void handle_death() {
while(true) {
// Use death (or leave Exile) dialog
choice = cChoiceDlog("party-death.xml",{"load","new","quit"}).show();
choice = cChoiceDlog("party-death",{"load","new","quit"}).show();
if(choice == "quit") {
All_Done = true;
@@ -2604,7 +2604,7 @@ void start_new_game() {
std::string choice;
using kb = sf::Keyboard;
choice = cChoiceDlog("new-party.xml",{"okay","cancel"}).show();
choice = cChoiceDlog("new-party",{"okay","cancel"}).show();
if(choice == "cancel")
return;
@@ -2872,7 +2872,7 @@ bool outd_move_party(location destination,bool forced) {
&& univ.scenario.ter_types[ter].special != eTerSpec::TOWN_ENTRANCE) {
// TODO: It kinda looks like there should be a check for eTerSpec::BRIDGE here?
// Note: Maybe not though, since this is where boating over lava was once hard-coded...?
if(cChoiceDlog("boat-bridge.xml",{"under","land"}).show() == "under")
if(cChoiceDlog("boat-bridge",{"under","land"}).show() == "under")
forced = true;
else {
add_string_to_buf("You leave the boat. ");
@@ -3033,7 +3033,7 @@ bool town_move_party(location destination,short forced) {
return false;
// Crossing bridge: land or go through
else if(!is_blocked(destination) && univ.scenario.ter_types[ter].boat_over && univ.scenario.ter_types[ter].special == eTerSpec::BRIDGE) {
if(cChoiceDlog("boat-bridge.xml",{"under","land"}).show() == "under")
if(cChoiceDlog("boat-bridge",{"under","land"}).show() == "under")
forced = true;
else if(!is_blocked(destination)) {
add_string_to_buf("You leave the boat. ");
@@ -3194,7 +3194,7 @@ bool check_for_interrupt(){
interrupt = true;
if(interrupt) {
// TODO: A customized dialog with a more appropriate message
cChoiceDlog confirm("quit-confirm-nosave.xml", {"quit","cancel"});
cChoiceDlog confirm("quit-confirm-nosave", {"quit","cancel"});
if(confirm.show() == "quit") return true;
}
return false;

View File

@@ -96,12 +96,12 @@ void set_up_apple_events() {
}
if(overall_mode < MODE_TALK_TOWN) {
std::string choice = cChoiceDlog("quit-confirm-save.xml", {"save", "quit", "cancel"}).show();
std::string choice = cChoiceDlog("quit-confirm-save", {"save", "quit", "cancel"}).show();
if(choice == "cancel") return; // TODO: Need to make sure the quit is actually cancelled here
if(choice == "save")
save_party(univ.file, univ);
} else {
std::string choice = cChoiceDlog("quit-confirm-nosave.xml", {"quit", "cancel"}).show();
std::string choice = cChoiceDlog("quit-confirm-nosave", {"quit", "cancel"}).show();
if(choice == "cancel") return; // TODO: Need to make sure the quit is actually cancelled here
}

View File

@@ -441,7 +441,7 @@ bool pc_combat_move(location destination) {
s1 = univ.town.monst[monst_hit].attitude;
if(s1 % 2 == 1) s2 = 2;
else {
std::string result = cChoiceDlog("attack-friendly.xml",{"cancel","attack"}).show();
std::string result = cChoiceDlog("attack-friendly",{"cancel","attack"}).show();
if(result == "cancel") s2 = 1;
else if(result == "attack") s2 = 2;
}

View File

@@ -990,7 +990,7 @@ void do_sign(short town_num, short which_sign, short sign_type) {
view_loc = (is_out()) ? univ.party.p_loc : univ.town.p_loc;
make_cursor_sword();
cChoiceDlog sign("view-sign.xml");
cChoiceDlog sign("view-sign");
cPict& pict = dynamic_cast<cPict&>(sign->getControl("ter"));
store_sign_mode = sign_type;
@@ -1127,7 +1127,7 @@ static bool prefs_event_filter (cDialog& me, std::string id, eKeyMod) {
void pick_preferences() {
make_cursor_sword();
cDialog prefsDlog("preferences.xml");
cDialog prefsDlog("preferences");
prefsDlog.attachClickHandlers(&prefs_event_filter, {"okay", "cancel"});
cLedGroup& displayMode = dynamic_cast<cLedGroup&>(prefsDlog["display"]);
@@ -1252,7 +1252,7 @@ static bool edit_party_event_filter(cDialog& me, std::string item_hit, eKeyMod)
put_party_stats(me);
} else if(item_hit == "delete") { // Note: This button is also used for "create new PC".
if(univ.party[which_pc].main_status != eMainStatus::ABSENT) {
if(cChoiceDlog("delete-pc-confirm.xml",{"yes","no"}).show() == "yes")
if(cChoiceDlog("delete-pc-confirm",{"yes","no"}).show() == "yes")
univ.party[which_pc].main_status = eMainStatus::ABSENT;
put_party_stats(me);
}
@@ -1279,7 +1279,7 @@ void edit_party() {
pc_gworld.loadFromImage(*ResMgr::get<ImageRsrc>("pcs"));
}
cDialog pcDialog("edit-party.xml");
cDialog pcDialog("edit-party");
std::vector<std::string> buttons = {"done", "help"};
for(int i = 1; i <= 6; i++) {
std::string n = boost::lexical_cast<std::string>(i);
@@ -1329,7 +1329,7 @@ void tip_of_day() {
make_cursor_sword();
cDialog tips("tip-of-day.xml");
cDialog tips("tip-of-day");
tips.attachClickHandlers(&tip_of_day_event_filter,{"done","next"});
place_str = get_str("tips",50 + store_tip_page_on);
@@ -1411,12 +1411,12 @@ short pick_a_scen() {
store_scen_page_on = 0;
if(store_num_scen == 0) {
cChoiceDlog("no-scenarios.xml").show();
cChoiceDlog("no-scenarios").show();
return -1;
}
make_cursor_sword();
cDialog pickScen("pick-scenario.xml");
cDialog pickScen("pick-scenario");
pickScen.attachClickHandlers(pick_a_scen_event_filter, {"cancel", "next", "prev", "start1", "start2", "start3"});
put_scen_info(pickScen);
@@ -1434,7 +1434,7 @@ short pick_prefab_scen() {
make_cursor_sword();
cChoiceDlog pickScenario("pick-prefab-scen.xml", {"cancel", "scen1", "scen2", "scen3"});
cChoiceDlog pickScenario("pick-prefab-scen", {"cancel", "scen1", "scen2", "scen3"});
std::string item_hit = pickScenario.show();
if(item_hit == "cancel") return -1;

View File

@@ -124,7 +124,7 @@ void display_spells(eSkill mode,short force_spell,cDialog* parent) {
make_cursor_sword();
cDialog spellInfo("spell-info.xml", parent);
cDialog spellInfo("spell-info", parent);
spellInfo.attachClickHandlers(std::bind(display_spells_event_filter,_1,_2,mode), {"done","left","right"});
dynamic_cast<cPict&>(spellInfo["icon"]).setPict(mode == eSkill::MAGE_SPELLS ? 14 : 15);
@@ -180,7 +180,7 @@ void display_skills(eSkill force_skill,cDialog* parent) {
make_cursor_sword();
cDialog skillDlog("skill-info.xml", parent);
cDialog skillDlog("skill-info", parent);
skillDlog.attachClickHandlers(display_skills_event_filter,{"done", "left", "right"});
put_skill_info(skillDlog);
@@ -329,7 +329,7 @@ void display_pc_item(short pc_num,short item,cItemRec si,cDialog* parent) {
else store_i = univ.party[pc_num].items[item];
make_cursor_sword();
cDialog itemInfo("item-info.xml",parent);
cDialog itemInfo("item-info",parent);
// By attaching the click handler to "id" and "magic", we suppress normal LED behaviour
itemInfo.attachClickHandlers(std::bind(display_pc_item_event_filter, _1, _2, std::ref(store_i), std::ref(item), pc_num), {"done","left","right","id","magic"});
@@ -473,7 +473,7 @@ void display_monst(short array_pos,cCreature *which_m,short mode) {
make_cursor_sword();
cDialog monstInfo("monster-info.xml");
cDialog monstInfo("monster-info");
auto event_filter = std::bind(display_monst_event_filter, _1, _2,std::ref(store_m));
monstInfo["done"].attachClickHandler(std::bind(&cDialog::toast, &monstInfo, true));
monstInfo.attachClickHandlers(event_filter, {"left", "right"});
@@ -543,7 +543,7 @@ void display_alchemy() {
make_cursor_sword();
cDialog alchemy("many-str.xml");
cDialog alchemy("many-str");
alchemy.attachClickHandlers(display_alchemy_event_filter, {"done", "left", "right"});
get_text = get_str("alchemy", 1);
@@ -680,7 +680,7 @@ void give_pc_info(short pc_num) {
make_cursor_sword();
cDialog pcInfo("pc-info.xml");
cDialog pcInfo("pc-info");
pcInfo.attachClickHandlers(std::bind(give_pc_info_event_filter, _1, _2, std::ref(pc_num)), {"done", "left", "right"});
pcInfo.attachClickHandlers(give_pc_extra_info, {"seemage", "seepriest", "trait", "alch"});
@@ -753,7 +753,7 @@ void adventure_notes() {
make_cursor_sword();
cDialog encNotes("adventure-notes.xml");
cDialog encNotes("adventure-notes");
encNotes.attachClickHandlers(adventure_notes_event_filter, {"done", "left", "rigth", "del1", "del2", "del3"});
for(i = 0; i < 3; i++) {
@@ -816,7 +816,7 @@ void talk_notes() {
make_cursor_sword();
cDialog talkNotes("talk-notes.xml");
cDialog talkNotes("talk-notes");
talkNotes.attachClickHandlers(talk_notes_event_filter, {"done", "left", "right", "del"});
put_talk(talkNotes);
@@ -870,7 +870,7 @@ void journal() {
make_cursor_sword();
cDialog journal("event-journal.xml");
cDialog journal("event-journal");
journal.attachClickHandlers(journal_event_filter, {"done", "left", "right"});
for(i = 0; i < 3; i++) {

View File

@@ -562,7 +562,7 @@ void drop_item(short pc_num,short item_num,location where_drop) {
add_string_to_buf("Drop: Item is cursed. ");
else switch(overall_mode) {
case MODE_OUTDOORS:
choice = cChoiceDlog("drop-item-confirm.xml",{"okay","cancel"}).show();
choice = cChoiceDlog("drop-item-confirm",{"okay","cancel"}).show();
if(choice == "cancel")
return;
add_string_to_buf("Drop: OK");
@@ -975,7 +975,7 @@ static bool display_item_event_filter(cDialog& me, std::string id, size_t& first
item = *item_array[item_hit];
if(item.property) {
if(me.getResult<bool>()) {
std::string choice = cChoiceDlog("steal-item.xml",{"steal","leave"}).show();
std::string choice = cChoiceDlog("steal-item",{"steal","leave"}).show();
if(choice == "leave") return true;
me.setResult(true);
}
@@ -1059,7 +1059,7 @@ bool show_get_items(std::string titleText, std::vector<cItemRec*>& itemRefs, sho
if(!pc_gworld_loaded)
pc_gworld.loadFromImage(*ResMgr::get<ImageRsrc>("pcs"));
cDialog itemDialog("get-items.xml");
cDialog itemDialog("get-items");
auto handler = std::bind(display_item_event_filter, _1, _2, std::ref(first_item), std::ref(pc_getting), std::ref(itemRefs), overload);
itemDialog.attachClickHandlers(handler, {"done", "up", "down"});
itemDialog.attachClickHandlers(handler, {"pc1", "pc2", "pc3", "pc4", "pc5", "pc6"});
@@ -1112,7 +1112,7 @@ short custom_choice_dialog(std::array<std::string, 6>& strs,short pic_num,ePicTy
}
void custom_pic_dialog(std::string title, pic_num_t bigpic) {
cDialog pic_dlg("show-map.xml");
cDialog pic_dlg("show-map");
cControl& okay = pic_dlg["okay"];
cControl& text = pic_dlg["title"];
okay.attachClickHandler(std::bind(&cDialog::toast, &pic_dlg, false));
@@ -1182,7 +1182,7 @@ short get_num_of_items(short max_num) {
make_cursor_sword();
cDialog numPanel("get-num.xml");
cDialog numPanel("get-num");
numPanel.attachClickHandlers(get_num_of_items_event_filter, {"okay"});
sprintf((char *) sign_text,"How many? (0-%d) ",max_num);
@@ -1426,7 +1426,7 @@ static bool get_text_response_event_filter(cDialog& me, std::string, eKeyMod) {
std::string get_text_response(std::string prompt, pic_num_t pic) {
make_cursor_sword();
cDialog strPanel("get-response.xml");
cDialog strPanel("get-response");
strPanel.attachClickHandlers(get_text_response_event_filter, {"okay"});
if(!prompt.empty()) {
dynamic_cast<cPict&>(strPanel["pic"]).setPict(pic);
@@ -1445,7 +1445,7 @@ short get_num_response(short min, short max, std::string prompt) {
make_cursor_sword();
cDialog numPanel("get-num.xml");
cDialog numPanel("get-num");
numPanel.attachClickHandlers(get_num_of_items_event_filter, {"okay"});
sout << " (" << min << '-' << max << ')';

View File

@@ -178,7 +178,7 @@ int main(int /*argc*/, char* argv[]) {
mainPtr.display();
if(!game_run_before)
cChoiceDlog("welcome.xml").show();
cChoiceDlog("welcome").show();
else if(give_intro_hint)
tip_of_day();
game_run_before = true;
@@ -328,7 +328,7 @@ void Handle_One_Event() {
case sf::Event::Closed:
if(overall_mode == MODE_STARTUP) {
if(party_in_memory) {
std::string choice = cChoiceDlog("quit-confirm-save.xml", {"save","quit","cancel"}).show();
std::string choice = cChoiceDlog("quit-confirm-save", {"save","quit","cancel"}).show();
if(choice == "cancel") break;
if(choice == "save") {
fs::path file = nav_put_party();
@@ -340,12 +340,12 @@ void Handle_One_Event() {
break;
}
if(overall_mode > MODE_TOWN){
std::string choice = cChoiceDlog("quit-confirm-nosave.xml", {"quit", "cancel"}).show();
std::string choice = cChoiceDlog("quit-confirm-nosave", {"quit", "cancel"}).show();
if(choice == "cancel")
break;
}
else {
std::string choice = cChoiceDlog("quit-confirm-save.xml", {"save", "quit", "cancel"}).show();
std::string choice = cChoiceDlog("quit-confirm-save", {"save", "quit", "cancel"}).show();
if(choice == "cancel")
break;
if(choice == "save")
@@ -433,7 +433,7 @@ void handle_apple_menu(int item_hit) {
switch(item_hit) {
case 1:
cChoiceDlog("about-boe.xml").show();
cChoiceDlog("about-boe").show();
break;
default:
// GetItem (apple_menu,item_hit,desk_acc_name);
@@ -458,7 +458,7 @@ void handle_file_menu(int item_hit) {
break;
case 4:
if(overall_mode != MODE_STARTUP) {
choice = cChoiceDlog("restart-game.xml",{"okay","cancel"}).show();
choice = cChoiceDlog("restart-game",{"okay","cancel"}).show();
if(choice == "cancel")
return;
for(i = 0; i < 6; i++)
@@ -479,7 +479,7 @@ void handle_file_menu(int item_hit) {
if(overall_mode == MODE_STARTUP) {
if(party_in_memory) {
std::string choice = cChoiceDlog("quit-confirm-save.xml", {"save","quit","cancel"}).show();
std::string choice = cChoiceDlog("quit-confirm-save", {"save","quit","cancel"}).show();
if(choice == "cancel") break;
if(choice == "save") {
fs::path file = nav_put_party();
@@ -491,12 +491,12 @@ void handle_file_menu(int item_hit) {
break;
}
if(overall_mode > MODE_TOWN) {
choice = cChoiceDlog("quit-confirm-nosave.xml",{"quit","cancel"}).show();
choice = cChoiceDlog("quit-confirm-nosave",{"quit","cancel"}).show();
if(choice == "cancel")
return;
}
else {
choice = cChoiceDlog("quit-confirm-save.xml",{"quit","save","cancel"}).show();
choice = cChoiceDlog("quit-confirm-save",{"quit","save","cancel"}).show();
if(choice == "cancel")
break;
if(choice == "save")
@@ -526,7 +526,7 @@ void handle_options_menu(int item_hit) {
else {
choice = char_select_pc(0,0,"Delete who?");
if(choice < 6) {
std::string confirm = cChoiceDlog("delete-pc-confirm.xml",{"yes","no"}).show();
std::string confirm = cChoiceDlog("delete-pc-confirm",{"yes","no"}).show();
if(confirm == "yes")
kill_pc(choice,eMainStatus::ABSENT);
}
@@ -597,12 +597,12 @@ void handle_options_menu(int item_hit) {
void handle_help_menu(int item_hit) {
std::string dialogToShow;
switch(item_hit) {
case 1: dialogToShow = "help-outdoor.xml"; break;
case 2: dialogToShow = "help-town.xml"; break;
case 3: dialogToShow = "help-combat.xml"; break;
case 4: dialogToShow = "help-fields.xml"; break;
case 6: dialogToShow = "help-hints.xml"; break;
case 7: dialogToShow = "help-magic.xml"; break;
case 1: dialogToShow = "help-outdoor"; break;
case 2: dialogToShow = "help-town"; break;
case 3: dialogToShow = "help-combat"; break;
case 4: dialogToShow = "help-fields"; break;
case 6: dialogToShow = "help-hints"; break;
case 7: dialogToShow = "help-magic"; break;
}
if(!dialogToShow.empty())
cChoiceDlog(dialogToShow).show();
@@ -623,7 +623,7 @@ void handle_library_menu(int item_hit) {
case 5:
tip_of_day(); break;
case 7:
cChoiceDlog("welcome.xml").show();
cChoiceDlog("welcome").show();
break;
}
}

View File

@@ -205,7 +205,7 @@ void init_party_scen_data() {
if(univ.party.stored_items[i][j].variety != eItemType::NO_ITEM)
stored_item = true;
if(stored_item)
if(cChoiceDlog("keep-stored-items.xml", {"yes", "no"}).show() == "yes") {
if(cChoiceDlog("keep-stored-items", {"yes", "no"}).show() == "yes") {
std::vector<cItemRec*> saved_item_refs;
for(i = 0; i < 3;i++)
for(j = 0; j < NUM_TOWN_ITEMS; j++)
@@ -266,7 +266,7 @@ void put_party_in_scen(std::string scen_name) {
}
}
if(item_took)
cChoiceDlog("removed-special-items.xml").show();
cChoiceDlog("removed-special-items").show();
univ.party.age = 0;
for(i = 0; i < 200; i++)
univ.party.m_killed[i] = 0;
@@ -2274,7 +2274,7 @@ eSpell pick_spell(short pc_num,eSkill type) { // 70 - no spell OW spell num
make_cursor_sword();
cDialog castSpell("cast-spell.xml");
cDialog castSpell("cast-spell");
castSpell.attachClickHandlers(std::bind(pick_spell_caster, _1, _2, type, std::ref(dark), std::ref(former_spell)), {"caster1","caster2","caster3","caster4","caster5","caster6"});
castSpell.attachClickHandlers(std::bind(pick_spell_target,_1,_2, type, dark, former_spell), {"target1","target2","target3","target4","target5","target6"});
@@ -2475,7 +2475,7 @@ short alch_choice(short pc_num) {
store_alchemy_pc = pc_num;
cDialog chooseAlchemy("pick-potion.xml");
cDialog chooseAlchemy("pick-potion");
chooseAlchemy.attachClickHandlers(alch_choice_event_filter, {"cancel", "help"});
for(i = 0; i < 20; i++) {
std::string n = boost::lexical_cast<std::string>(i + 1);
@@ -2546,7 +2546,7 @@ bool pick_pc_name(short pc_num,cDialog* parent) {
using namespace std::placeholders;
make_cursor_sword();
cDialog pcPickName("pick-pc-name.xml", parent);
cDialog pcPickName("pick-pc-name", parent);
pcPickName["name"].setText(univ.party[pc_num].name);
pcPickName["okay"].attachClickHandler(std::bind(pc_name_event_filter, _1, pc_num));
@@ -2563,7 +2563,7 @@ m_num_t pick_trapped_monst() {
make_cursor_sword();
cChoiceDlog soulCrystal("soul-crystal.xml",{"cancel","pick1","pick2","pick3","pick4"});
cChoiceDlog soulCrystal("soul-crystal",{"cancel","pick1","pick2","pick3","pick4"});
for(i = 0; i < 4; i++) {
std::string n = boost::lexical_cast<std::string>(i + 1);

View File

@@ -461,7 +461,7 @@ bool check_special_terrain(location where_check,eSpecCtx mode,short which_pc,sho
}
// See what party wants to do.
choice = cChoiceDlog("locked-door-action.xml",{"leave","pick","bash"}).show();
choice = cChoiceDlog("locked-door-action",{"leave","pick","bash"}).show();
can_enter = false;
if(choice == "leave")
@@ -2485,7 +2485,7 @@ void oneshot_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
i = custom_choice_dialog(strs,27,PIC_DLOG,buttons);
// TODO: Make custom_choice_dialog return string?
}
else i = cChoiceDlog("basic-trap.xml",{"yes","no"}).show() == "no";
else i = cChoiceDlog("basic-trap",{"yes","no"}).show() == "no";
if(i == 1) {set_sd = false; *next_spec = -1; *a = 1;}
else {
if(is_combat())
@@ -3385,10 +3385,10 @@ void set_terrain(location l, ter_num_t terrain_type) {
void townmode_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
short *next_spec,short */*next_spec_type*/,short *a,short *b,short *redraw) {
static const char*const stairDlogs[8] = {
"basic-stair-up.xml", "basic-stair-down.xml",
"basic-slope-up.xml", "basic-slope-down.xml",
"slimy-stair-up.xml", "slimy-stair-down.xml",
"dark-slope-up.xml", "dark-slope-down.xml"
"basic-stair-up", "basic-stair-down",
"basic-slope-up", "basic-slope-down",
"slimy-stair-up", "slimy-stair-down",
"dark-slope-up", "dark-slope-down"
};
bool check_mess = true;
std::array<std::string, 6> strs;
@@ -3530,7 +3530,7 @@ void townmode_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
*next_spec = -1;
check_mess = false;
}
else if(cChoiceDlog("basic-portal.xml",{"yes","no"}).show() == "yes") {
else if(cChoiceDlog("basic-portal",{"yes","no"}).show() == "yes") {
*a = 1;
if(which_mode == eSpecCtx::TALK)
teleport_party(spec.ex1a,spec.ex1b,1);
@@ -3538,7 +3538,7 @@ void townmode_spec(eSpecCtx which_mode,cSpecial cur_node,short cur_spec_type,
}
break;
case eSpecType::TOWN_GENERIC_BUTTON:
if(cChoiceDlog("basic-button.xml",{"yes","no"}).show() == "yes")
if(cChoiceDlog("basic-button",{"yes","no"}).show() == "yes")
*next_spec = spec.ex1b;
break;
case eSpecType::TOWN_GENERIC_STAIR:

View File

@@ -77,7 +77,7 @@ bool handle_startup_press(location the_point) {
case STARTBTN_JOIN: // regular scen
if(!party_in_memory) {
cChoiceDlog("need-party.xml").show();
cChoiceDlog("need-party").show();
break;
}
scen = pick_prefab_scen();
@@ -96,7 +96,7 @@ bool handle_startup_press(location the_point) {
case STARTBTN_CUSTOM: // custom
if(!party_in_memory) {
cChoiceDlog("need-party.xml").show();
cChoiceDlog("need-party").show();
break;
}
// if not reg, rub out
@@ -104,7 +104,7 @@ bool handle_startup_press(location the_point) {
scen = pick_a_scen();
if(scen < 0) break;
if(scen_headers.data(scen).prog_make_ver[0] >= 2) {
cChoiceDlog("scen-version-mismatch.xml").show();
cChoiceDlog("scen-version-mismatch").show();
break;
}
scen_name = scen_headers.strs(scen).file;

View File

@@ -214,7 +214,7 @@ location get_spec_loc(short which) {
// 1 if pull
// levers should always start to left.
short handle_lever(location w) {
if(cChoiceDlog("basic-lever.xml",{"pull", "leave"}).show() == "leave")
if(cChoiceDlog("basic-lever",{"pull", "leave"}).show() == "leave")
return 0;
play_sound(94);
switch_lever(w);

View File

@@ -823,7 +823,7 @@ template<> pair<string,cStack*> cDialog::parse(Element& who /*stack*/) {
cDialog::cDialog(cDialog* p) : parent(p) {}
cDialog::cDialog(std::string path, cDialog* p) : parent(p) {
loadFromFile(path);
loadFromFile(path + ".xml");
}
extern fs::path progDir;

View File

@@ -25,7 +25,7 @@ const size_t cPictChoice::per_page = 36;
cPictChoice::cPictChoice(std::vector<pic_num_t>& pics,ePicType t,cDialog* parent) : cPictChoice(pics.begin(), pics.end(), t, parent) {}
cPictChoice::cPictChoice(std::vector<std::pair<pic_num_t,ePicType>>& pics,cDialog* parent) : dlg("choose-pict.xml",parent) {
cPictChoice::cPictChoice(std::vector<std::pair<pic_num_t,ePicType>>& pics,cDialog* parent) : dlg("choose-pict",parent) {
picts = pics;
attachHandlers();
}
@@ -35,14 +35,14 @@ cPictChoice::cPictChoice(
std::vector<pic_num_t>::iterator end,
ePicType t,
cDialog* parent
) : dlg("choose-pict.xml",parent) {
) : dlg("choose-pict",parent) {
for(auto iter = begin; iter != end; iter++) {
picts.push_back({*iter,t});
}
attachHandlers();
}
cPictChoice::cPictChoice(pic_num_t first, pic_num_t last, ePicType t, cDialog* parent) : dlg("choose-pict.xml",parent) {
cPictChoice::cPictChoice(pic_num_t first, pic_num_t last, ePicType t, cDialog* parent) : dlg("choose-pict",parent) {
for(pic_num_t i = first; i <= last; i++) {
picts.push_back({i,t});
}
@@ -158,7 +158,7 @@ cStringChoice::cStringChoice(
std::vector<std::string>& strs,
std::string title,
cDialog* parent
) : dlg("choose-string.xml",parent) {
) : dlg("choose-string",parent) {
if(!title.empty()) dlg["title"].setText(title);
strings = strs;
attachHandlers();
@@ -169,7 +169,7 @@ cStringChoice::cStringChoice(
std::vector<std::string>::iterator end,
std::string title,
cDialog* parent
) : dlg("choose-string.xml",parent) {
) : dlg("choose-string",parent) {
if(!title.empty()) dlg["title"].setText(title);
copy(begin,end,std::inserter(strings, strings.begin()));
attachHandlers();
@@ -458,7 +458,6 @@ std::string cStrDlog::getFileName(short n_strs, ePicType type, bool hasTitle){
if(hasTitle) sout << "-title";
if(type == PIC_DLOG_LG || type == PIC_CUSTOM_DLOG_LG || type == PIC_SCEN_LG)
sout << "-lg";
sout << ".xml";
return sout.str();
}

View File

@@ -134,7 +134,7 @@ void edit_gold_or_food(short which_to_edit) {
store_which_to_edit = which_to_edit;
make_cursor_sword();
cDialog dlog("get-num.xml");
cDialog dlog("get-num");
dlog["okay"].attachClickHandler(get_num_event_filter);
if(which_to_edit == 0)
dlog["prompt"].setText("How much gold do you want?");
@@ -156,7 +156,7 @@ void edit_day() {
make_cursor_sword();
cDialog dlog("edit-day.xml");
cDialog dlog("edit-day");
dlog["okay"].attachClickHandler(get_num_event_filter);
dlog["number"].setTextToNum(((univ.party.age) / 3700) + 1);
@@ -270,7 +270,7 @@ void edit_xp(cPlayer *pc) {
make_cursor_sword();
cDialog dlog("edit-xp.xml");
cDialog dlog("edit-xp");
dlog["okay"].attachClickHandler(get_num_event_filter);
dlog["number"].setTextToNum(pc->experience);

View File

@@ -115,7 +115,7 @@ short char_select_pc(short active_only,short free_inv_only,const char *title) {
make_cursor_sword();
cDialog selectPc("select-pc.xml");
cDialog selectPc("select-pc");
selectPc.attachClickHandlers(select_pc_event_filter, {"cancel", "pick1", "pick2", "pick3", "pick4", "pick5", "pick6"});
selectPc["title"].setText(title);
@@ -207,7 +207,7 @@ void display_pc(short pc_num,short mode, cDialog* parent) {
make_cursor_sword();
cDialog pcInfo("pc-spell-info.xml", parent);
cDialog pcInfo("pc-spell-info", parent);
pcInfo.attachClickHandlers(std::bind(display_pc_event_filter, _1, _2, mode),{"done","left","right"});
for(i = 0; i < 62; i++) {
@@ -291,7 +291,7 @@ void pick_race_abil(cPlayer *pc,short mode) {
store_pc = pc;
make_cursor_sword();
cDialog pickAbil("pick-race-abil.xml");
cDialog pickAbil("pick-race-abil");
pickAbil["done"].attachClickHandler(std::bind(&cDialog::toast, &pickAbil, true));
auto led_selector = std::bind(pick_race_select_led, _1, _2, _3, mode);
pickAbil.attachFocusHandlers(led_selector, {"race", "bad1", "bad2", "bad3", "bad4", "bad5"});
@@ -318,7 +318,7 @@ void display_alchemy(bool allowEdit) {
make_cursor_sword();
cChoiceDlog showAlch("pc-alchemy-info.xml", {"done"});
cChoiceDlog showAlch("pc-alchemy-info", {"done"});
for(i = 0; i < 20; i++) {
std::string id = "potion" + boost::lexical_cast<std::string>(i + 1);
@@ -601,7 +601,7 @@ bool spend_xp(short pc_num, short mode, cDialog* parent) {
std::map<eSkill,short> skills = univ.party[pc_num].skills;
cDialog xpDlog("spend-xp.xml",parent);
cDialog xpDlog("spend-xp",parent);
xpDlog.addLabelFor("hp","Health (1/10)",LABEL_LEFT,75,true);
xpDlog.addLabelFor("sp","Spell Pts. (1/15)",LABEL_LEFT,75,true);
auto spend_xp_filter = std::bind(spend_xp_event_filter,_1,_2,_3,std::ref(skills));

View File

@@ -200,7 +200,7 @@ void handle_apple_menu(int item_hit) {
switch(item_hit) {
case 1:
cChoiceDlog("about-pced.xml").show();
cChoiceDlog("about-pced").show();
break;
default:
//GetItem (apple_menu,item_hit,desk_acc_name);
@@ -264,19 +264,19 @@ void handle_extra_menu(int item_hit) {
case 4:
if(univ.party.is_split() > 0) {
cChoiceDlog("reunite-first.xml").show();
cChoiceDlog("reunite-first").show();
break;
}
cChoiceDlog("leave-town.xml").show();
cChoiceDlog("leave-town").show();
leave_town();
break;
case 5:
if(univ.party.is_split() == 0) {
cChoiceDlog("not-split.xml").show();
cChoiceDlog("not-split").show();
break;
}
cChoiceDlog("reunited.xml").show();
cChoiceDlog("reunited").show();
univ.town.p_loc = univ.party.left_at();
for(i = 0; i < 6; i++)
if(univ.party[i].main_status >= eMainStatus::SPLIT)
@@ -326,7 +326,7 @@ void handle_extra_menu(int item_hit) {
display_strings(25,15);
break;
}
if(cChoiceDlog("leave-scenario.xml",{"okay","cancel"}).show() != "okay")
if(cChoiceDlog("leave-scenario",{"okay","cancel"}).show() != "okay")
break;
remove_party_from_scen();
break;
@@ -472,7 +472,7 @@ bool verify_restore_quit(bool mode) {
if(file_in_mem.empty())
return true;
cChoiceDlog verify(mode ? "save-open.xml" : "save-quit.xml", {"save", "quit", "cancel"});
cChoiceDlog verify(mode ? "save-open" : "save-quit", {"save", "quit", "cancel"});
choice = verify.show();
if(choice == "cancel")
return false;

View File

@@ -232,7 +232,7 @@ bool handle_action(location the_point,sf::Event /*event*/) {
break;
case 11: // pick out
if(change_made) {
if(!save_check("save-section-confirm.xml"))
if(!save_check("save-section-confirm"))
break;
}
spot_hit = pick_out(cur_out);
@@ -249,10 +249,10 @@ bool handle_action(location the_point,sf::Event /*event*/) {
break;
case 16: // pick town
if(change_made) {
if(!save_check("save-section-confirm.xml"))
if(!save_check("save-section-confirm"))
break;
}
x = pick_town_num("select-town-edit.xml",cur_town);
x = pick_town_num("select-town-edit",cur_town);
if(x >= 0){
cur_town = x;
town = scenario.towns[cur_town];
@@ -839,7 +839,7 @@ bool handle_action(location the_point,sf::Event /*event*/) {
}
if(!editing_town) {
if((spot_hit.x == 0) || (spot_hit.x == 47) || (spot_hit.y == 0) || (spot_hit.y == 47)) {
cChoiceDlog("not-at-edge.xml").show();
cChoiceDlog("not-at-edge").show();
break;
}
for(x = 0; x < 18; x++)
@@ -885,7 +885,7 @@ bool handle_action(location the_point,sf::Event /*event*/) {
set_cursor(wand_curs);
break;
case MODE_SET_OUT_START: //edit out start loc
if(cChoiceDlog("set-out-start-confirm.xml", {"okay", "cancel"}).show() == "cancel")
if(cChoiceDlog("set-out-start-confirm", {"okay", "cancel"}).show() == "cancel")
break;
if((spot_hit.x != minmax(4,43,spot_hit.x)) ||
(spot_hit.y != minmax(4,43,spot_hit.y))) {
@@ -1927,7 +1927,7 @@ void set_terrain(location l,ter_num_t terrain_type) {
}
if(scenario.ter_types[terrain_type].special == eTerSpec::IS_A_SIGN && !editing_town) {
if((l.x == 0) || (l.x == 47) || (l.y == 0) || (l.y == 47)) {
cChoiceDlog("not-at-edge.xml").show();
cChoiceDlog("not-at-edge").show();
mouse_button_held = false;
return;
}
@@ -2896,7 +2896,7 @@ void place_edit_special(location loc) {
if(!editing_town) {
if((loc.x == 0) || (loc.x == 47) || (loc.y == 0) || (loc.y == 47)) {
cChoiceDlog("not-at-edge.xml").show();
cChoiceDlog("not-at-edge").show();
return;
}
for(i = 0; i < 18; i++)
@@ -2955,7 +2955,7 @@ void set_special(location spot_hit) {
}
if(!editing_town) {
if((spot_hit.x == 0) || (spot_hit.x == 47) || (spot_hit.y == 0) || (spot_hit.y == 47)) {
cChoiceDlog("not-at-edge.xml").show();
cChoiceDlog("not-at-edge").show();
return;
}
for(x = 0; x < 18; x++)
@@ -3000,13 +3000,13 @@ void town_entry(location spot_hit) {
y = -2;
for(x = 0; x < 8; x++)
if((current_terrain->exit_locs[x].x == spot_hit.x) && (current_terrain->exit_locs[x].y == spot_hit.y)) {
y = pick_town_num("select-town-enter.xml",current_terrain->exit_dests[x]);
y = pick_town_num("select-town-enter",current_terrain->exit_dests[x]);
if(y >= 0) current_terrain->exit_dests[x] = y;
}
if(y == -2) {
for(x = 0; x < 8; x++)
if(current_terrain->exit_locs[x].x == 100) {
y = pick_town_num("select-town-enter.xml",0);
y = pick_town_num("select-town-enter",0);
if(y >= 0) {
current_terrain->exit_dests[x] = y;
current_terrain->exit_locs[x] = spot_hit;

View File

@@ -326,7 +326,7 @@ static bool finish_editing_ter(cDialog& me, std::string id, ter_num_t& which_ter
short edit_ter_type(ter_num_t which_ter) {
using namespace std::placeholders;
cDialog ter_dlg("edit-terrain.xml");
cDialog ter_dlg("edit-terrain");
// Attach handlers
ter_dlg["pict"].attachFocusHandler(std::bind(check_range,_1,_2,_3,0,2999,"terrain graphic"));
ter_dlg["pickpict"].attachClickHandler(std::bind(pick_picture,PIC_TER,_1,"pict","graphic",0));
@@ -548,7 +548,7 @@ short edit_monst_type(short which_monst) {
using namespace std::placeholders;
cMonster store_monst = scenario.scen_monsters[which_monst];
cDialog monst_dlg("edit-monster.xml");
cDialog monst_dlg("edit-monster");
monst_dlg["pickicon"].attachClickHandler(std::bind(pick_picture,PIC_MONST,_1,"pic","icon",0));
monst_dlg["picktalk"].attachClickHandler(std::bind(pick_picture,PIC_TALK,_1,"talk","",0));
monst_dlg["cancel"].attachClickHandler(std::bind(&cDialog::toast, &monst_dlg, false));
@@ -677,7 +677,7 @@ cMonster edit_monst_abil(cMonster starting_record,short which_monst) {
using namespace std::placeholders;
cMonster store_monst = starting_record;
cDialog monst_dlg("edit-monster-abils.xml");
cDialog monst_dlg("edit-monster-abils");
monst_dlg["poison"].attachFocusHandler(std::bind(check_range, _1, _2, _3, 0, 8, "Poison"));
monst_dlg["breath-str"].attachFocusHandler(std::bind(check_range, _1, _2, _3, 0, 4, "Breath Damage"));
monst_dlg["loot-item"].attachFocusHandler(std::bind(check_range_msg, _1, _2, _3, -1, 399, "Item To Drop", "-1 for no item"));
@@ -929,7 +929,7 @@ short edit_item_type(short which_item) {
using namespace std::placeholders;
cItemRec store_item = scenario.scen_items[which_item];
cDialog item_dlg("edit-item.xml");
cDialog item_dlg("edit-item");
item_dlg["level"].attachFocusHandler(std::bind(check_range, _1, _2, _3, 0, 50, "Item Level"));
item_dlg["awkward"].attachFocusHandler(std::bind(check_range, _1, _2, _3, 0, 20, "Awkward"));
item_dlg["bonus"].attachFocusHandler(std::bind(check_range, _1, _2, _3, 0, 60, "Bonus"));
@@ -1067,7 +1067,7 @@ cItemRec edit_item_abil(cItemRec starting_record,short which_item) {
cItemRec store_item = starting_record;
cDialog item_dlg("edit-item-abils.xml");
cDialog item_dlg("edit-item-abils");
if(store_item.ability != eItemAbil::SUMMONING && store_item.ability != eItemAbil::MASS_SUMMONING) {
item_dlg["str"].attachFocusHandler(std::bind(check_range, _1, _2, _3, 0, 10, "Ability Strength"));
} else {
@@ -1146,7 +1146,7 @@ void edit_spec_item(short which_item) {
using namespace std::placeholders;
cSpecItem store_item = scenario.special_items[which_item];
cDialog item_dlg("edit-special-item.xml");
cDialog item_dlg("edit-special-item");
item_dlg["spec"].attachFocusHandler(std::bind(check_range_msg, _1, _2, _3, -1, 255, "Scenario special node called", "-1 for no special"));
item_dlg.attachClickHandlers(std::bind(edit_spec_item_event_filter, _1, _2, std::ref(store_item), which_item), {"okay", "cancel", "clear", "edit-spec", "left", "right"});
@@ -1213,7 +1213,7 @@ static bool edit_save_rects_event_filter(cDialog& me, std::string item_hit) {
void edit_save_rects() {
using namespace std::placeholders;
cDialog save_dlg("edit-save-rects.xml");
cDialog save_dlg("edit-save-rects");
save_dlg.attachClickHandlers(std::bind(edit_save_rects_event_filter, _1, _2), {"okay"});
put_save_rects_in_dlog(save_dlg);
@@ -1276,7 +1276,7 @@ void edit_horses() {
using namespace std::placeholders;
size_t page = 0;
cDialog horse_dlg("edit-horses.xml");
cDialog horse_dlg("edit-horses");
horse_dlg.attachClickHandlers(std::bind(edit_vehicles_event_filter, _1, _2, scenario.horses, 30, std::ref(page)), {"okay", "left", "right"});
put_vehicles_in_dlog(horse_dlg, scenario.horses, page);
@@ -1288,7 +1288,7 @@ void edit_boats() {
using namespace std::placeholders;
size_t page = 0;
cDialog boat_dlg("edit-boats.xml");
cDialog boat_dlg("edit-boats");
boat_dlg.attachClickHandlers(std::bind(edit_vehicles_event_filter, _1, _2, scenario.boats, 30, std::ref(page)), {"okay", "left", "right"});
put_vehicles_in_dlog(boat_dlg, scenario.boats, page);
@@ -1336,7 +1336,7 @@ static bool edit_add_town_event_filter(cDialog& me, std::string item_hit) {
void edit_add_town() {
using namespace std::placeholders;
cDialog vary_dlg("edit-town-varying.xml");
cDialog vary_dlg("edit-town-varying");
vary_dlg.attachClickHandlers(std::bind(edit_add_town_event_filter, _1, _2), {"okay"});
put_add_town_in_dlog(vary_dlg);
@@ -1426,7 +1426,7 @@ void edit_item_placement() {
cScenario::cItemStorage store_storage = scenario.storage_shortcuts[0];
short cur_shortcut = 0;
cDialog shortcut_dlg("edit-item-shortcut.xml");
cDialog shortcut_dlg("edit-item-shortcut");
shortcut_dlg.attachClickHandlers(std::bind(edit_item_placement_event_filter, _1, _2, std::ref(store_storage), std::ref(cur_shortcut)), {"okay", "cancel", "left", "right", "choose-ter"});
for(int i = 0; i < 10; i++) {
std::string id = "choose-item" + std::to_string(i + 1);
@@ -1473,7 +1473,7 @@ static bool edit_scen_details_event_filter(cDialog& me, std::string, eKeyMod) {
}
void edit_scen_details() {
cDialog info_dlg("edit-scenario-details.xml");
cDialog info_dlg("edit-scenario-details");
info_dlg["okay"].attachClickHandler(edit_scen_details_event_filter);
put_scen_details_in_dlog(info_dlg);
@@ -1505,7 +1505,7 @@ static bool edit_make_scen_1_event_filter(cDialog& me, std::string, eKeyMod) {
}
bool edit_make_scen_1(std::string& filename,std::string& title,bool& grass) {
cDialog new_dlog("make-scenario1.xml");
cDialog new_dlog("make-scenario1");
new_dlog["okay"].attachClickHandler(edit_make_scen_1_event_filter);
new_dlog["cancel"].attachClickHandler(std::bind(&cDialog::toast, &new_dlog, false));
new_dlog.setResult(false);
@@ -1540,7 +1540,7 @@ static bool edit_make_scen_2_event_filter(cDialog& me, std::string, eKeyMod) {
}
bool edit_make_scen_2(short& out_w, short& out_h, short& town_l, short& town_m, short& town_s, bool& def_town) {
cDialog new_dlog("make-scenario2.xml");
cDialog new_dlog("make-scenario2");
new_dlog["okay"].attachClickHandler(edit_make_scen_2_event_filter);
new_dlog["cancel"].attachClickHandler(std::bind(&cDialog::toast, &new_dlog, false));
new_dlog.setResult(false);
@@ -1657,7 +1657,7 @@ void set_starting_loc() {
using namespace std::placeholders;
// ignore parent in Mac version
cDialog loc_dlg("set-start-loc.xml");
cDialog loc_dlg("set-start-loc");
loc_dlg["cancel"].attachClickHandler(std::bind(&cDialog::toast, &loc_dlg, false));
loc_dlg["okay"].attachClickHandler(set_starting_loc_filter);
loc_dlg["town-num"].attachFocusHandler(std::bind(check_range, _1, _2, _3, 0, scenario.num_towns - 1, "The starting town"));
@@ -1711,7 +1711,7 @@ static bool edit_scenario_events_event_filter(cDialog& me, std::string item_hit,
void edit_scenario_events() {
using namespace std::placeholders;
cDialog evt_dlg("edit-scenario-events.xml");
cDialog evt_dlg("edit-scenario-events");
evt_dlg["okay"].attachClickHandler(save_scenario_events);
for(int i = 0; i < 10; i++) {
std::string id = std::to_string(i + 1);

View File

@@ -305,7 +305,7 @@ static bool edit_text_event_filter(cDialog& me, std::string item_hit, short& whi
void edit_text_str(short which_str,short mode) {
using namespace std::placeholders;
cDialog dlog("edit-text.xml");
cDialog dlog("edit-text");
dlog.attachClickHandlers(std::bind(edit_text_event_filter, _1, _2, std::ref(which_str), mode), {"okay", "left", "right"});
dlog["num"].setTextToNum(which_str);
@@ -344,7 +344,7 @@ static bool edit_area_rect_event_filter(cDialog& me, std::string item_hit, short
bool edit_area_rect_str(short which_str,short mode) {
using namespace std::placeholders;
cDialog dlog("set-area-desc.xml");
cDialog dlog("set-area-desc");
dlog.attachClickHandlers(std::bind(edit_area_rect_event_filter, _1, _2, which_str, mode), {"okay", "cancel"});
if(mode == 0)
@@ -469,7 +469,7 @@ static bool commit_spec_enc(cDialog& me, std::string item_hit, node_stack_t& edi
static bool discard_spec_enc(cDialog& me, node_stack_t& edit_stack) {
if(edit_stack.size() > 1) {
std::string action = cChoiceDlog("discard-special-node.xml", {"save", "cancel", "revert"}).show();
std::string action = cChoiceDlog("discard-special-node", {"save", "cancel", "revert"}).show();
if(action == "save") return true;
if(action == "cancel") return me.toast(false);
edit_stack.pop();
@@ -730,7 +730,7 @@ bool edit_spec_enc(short which_node,short mode,cDialog* parent) {
if(the_node.pic < 0)
the_node.pic = 0;
cDialog special("edit-special-node.xml",parent);
cDialog special("edit-special-node",parent);
special.attachClickHandlers(std::bind(commit_spec_enc, _1, _2, std::ref(edit_stack)), {"okay", "back"});
special.attachClickHandlers(std::bind(edit_spec_enc_type, _1, _2, std::ref(edit_stack)), {
"general", "oneshot", "affectpc", "ifthen", "town", "out", "rect"
@@ -929,7 +929,7 @@ void edit_spec_text(short mode,short *str1,short *str2,cDialog* parent) {
using namespace std::placeholders;
short num_s_strs[3] = {100,90,100};
cDialog edit("edit-special-text.xml", parent);
cDialog edit("edit-special-text", parent);
edit.attachClickHandlers(std::bind(edit_spec_text_event_filter, _1, _2, mode, str1, str2), {"okay", "cancel"});
if(*str1 >= num_s_strs[mode])
@@ -1075,7 +1075,7 @@ void edit_dialog_text(short mode,short *str1,cDialog* parent) {
}
using namespace std::placeholders;
cDialog edit("edit-dialog-text.xml",parent);
cDialog edit("edit-dialog-text",parent);
edit.attachClickHandlers(std::bind(edit_dialog_text_event_filter, _1, _2, mode, str1), {"okay", "cancel"});
if(*str1 >= 0){
@@ -1117,7 +1117,7 @@ static bool edit_special_num_event_filter(cDialog& me, std::string item_hit, sho
short edit_special_num(short mode,short what_start) {
using namespace std::placeholders;
cDialog edit("edit-special-assign.xml");
cDialog edit("edit-special-assign");
edit.attachClickHandlers(std::bind(edit_special_num_event_filter, _1, _2, mode), {"okay", "cancel"});
edit["num"].setTextToNum(what_start);
@@ -1157,7 +1157,7 @@ static bool edit_scen_intro_event_filter(cDialog& me, std::string item_hit, eKey
void edit_scen_intro() {
short i;
cDialog edit("edit-intro.xml");
cDialog edit("edit-intro");
edit.attachClickHandlers(edit_scen_intro_event_filter, {"okay", "cancel", "choose"});
edit["picnum"].setTextToNum(scenario.intro_pic);

View File

@@ -220,7 +220,7 @@ void Handle_Update() {
void handle_apple_menu(int item_hit) {
switch(item_hit) {
case 1:
cChoiceDlog("about-scened.xml").show();
cChoiceDlog("about-scened").show();
break;
}
}
@@ -253,7 +253,7 @@ void handle_file_menu(int item_hit) {
break;
case 5: // quit
if(!save_check("save-before-quit.xml"))
if(!save_check("save-before-quit"))
break;
All_Done = true;
break;
@@ -371,15 +371,15 @@ void handle_scenario_menu(int item_hit) {
giveError("You can't delete the last town in a scenario while it's the town the party starts the scenario in. Change the parties starting point and try this again.");
return;
}
if(cChoiceDlog("delete-town-confirm.xml", {"okay", "cancel"}).show() == "okay")
if(cChoiceDlog("delete-town-confirm", {"okay", "cancel"}).show() == "okay")
delete_last_town();
break;
case 20: // Write Data to Text File
if(cChoiceDlog("data-dump-confirm.xml", {"okay", "cancel"}).show() == "okay")
if(cChoiceDlog("data-dump-confirm", {"okay", "cancel"}).show() == "okay")
start_data_dump();
break;
case 21: // Do Full Text Dump
if(cChoiceDlog("text-dump-confirm.xml", {"okay", "cancel"}).show() == "okay")
if(cChoiceDlog("text-dump-confirm", {"okay", "cancel"}).show() == "okay")
scen_text_dump();
redraw_screen();
break;
@@ -415,18 +415,18 @@ void handle_town_menu(int item_hit) {
edit_roomdescs(true);
break;
case 8:
if(cChoiceDlog("add-random-items.xml", {"okay", "cancel"}).show() == "cancel")
if(cChoiceDlog("add-random-items", {"okay", "cancel"}).show() == "cancel")
break;
place_items_in_town();
break; // add random
case 9:
for(i = 0; i < 64; i++)
town->preset_items[i].property = 0;
cChoiceDlog("set-not-owned.xml").show();
cChoiceDlog("set-not-owned").show();
draw_terrain();
break; // set not prop
case 10:
if(cChoiceDlog("clear-items-confirm.xml", {"okay", "cancel"}).show() == "cancel")
if(cChoiceDlog("clear-items-confirm", {"okay", "cancel"}).show() == "cancel")
break;
for(i = 0; i < 64; i++)
town->preset_items[i].code = -1;
@@ -495,16 +495,16 @@ void handle_outdoor_menu(int item_hit) {
void handle_help_menu(int item_hit) {
switch(item_hit) {
case 1:
cChoiceDlog("help-editing.xml").show();
cChoiceDlog("help-editing").show();
break; // started
case 2:
cChoiceDlog("help-testing.xml").show();
cChoiceDlog("help-testing").show();
break; // testing
case 3:
cChoiceDlog("help-distributing.xml").show();
cChoiceDlog("help-distributing").show();
break; // distributing
case 5:
cChoiceDlog("help-contest.xml").show();
cChoiceDlog("help-contest").show();
break; // contest
}
}

View File

@@ -107,7 +107,7 @@ void edit_placed_monst(short which_m) {
store_placed_monst = town->creatures(which_m);
store_which_placed_monst = which_m;
cDialog edit("edit-townperson.xml");
cDialog edit("edit-townperson");
edit.attachClickHandlers(edit_placed_monst_event_filter, {"type-edit", "pict-edit", "okay", "cancel", "more"});
put_placed_monst_in_dlog(edit);
@@ -175,7 +175,7 @@ static bool edit_placed_monst_adv_time_flag(cDialog& me, std::string id, bool lo
cCreature edit_placed_monst_adv(cCreature monst_record, cDialog& parent) {
store_placed_monst2 = monst_record;
cDialog edit("edit-townperson-advanced.xml", &parent);
cDialog edit("edit-townperson-advanced", &parent);
edit["okay"].attachClickHandler(edit_placed_monst_adv_event_filter);
edit["cancel"].attachClickHandler(edit_placed_monst_adv_event_filter);
edit["time"].attachFocusHandler(edit_placed_monst_adv_time_flag);
@@ -242,7 +242,7 @@ void edit_placed_item(short which_i) {
cTown::cItem placed_item = town->preset_items[which_i];
cDialog item_dlg("edit-placed-item.xml");
cDialog item_dlg("edit-placed-item");
item_dlg["cancel"].attachClickHandler(std::bind(&cDialog::toast, &item_dlg, false));
item_dlg["okay"].attachClickHandler(std::bind(get_placed_item_in_dlog, _1, std::ref(placed_item), which_i));
item_dlg["choose"].attachClickHandler(std::bind(edit_placed_item_event_filter, _1, std::ref(placed_item), which_i));
@@ -273,7 +273,7 @@ void edit_sign(short which_sign,short picture) {
using namespace std::placeholders;
location view_loc;
cDialog sign_dlg("edit-sign.xml");
cDialog sign_dlg("edit-sign");
sign_dlg["cancel"].attachClickHandler(std::bind(&cDialog::toast, &sign_dlg, false));
sign_dlg["okay"].attachClickHandler(std::bind(edit_sign_event_filter, _1, which_sign));
cPict& icon = dynamic_cast<cPict&>(sign_dlg["pic"]);
@@ -345,7 +345,7 @@ void edit_roomdescs(bool town) {
bool str_do_delete[16] = {0};
int numDescs = town ? 16 : 8;
cDialog room_dlg(town ? "edit-town-roomdescs.xml" : "edit-out-roomdescs.xml");
cDialog room_dlg(town ? "edit-town-roomdescs" : "edit-out-roomdescs");
room_dlg["okay"].attachClickHandler(std::bind(save_roomdescs, _1, town, str_do_delete));
room_dlg["cancel"].attachClickHandler(std::bind(&cDialog::toast, &room_dlg, false));
for(int i = 0; i < numDescs; i++) {
@@ -398,7 +398,7 @@ static bool save_ter_change(cDialog& me, std::string, eKeyMod) {
bool change_ter(short& change_from,short& change_to,short& chance) {
using namespace std::placeholders;
cDialog chg_dlg("change-terrain.xml");
cDialog chg_dlg("change-terrain");
chg_dlg["cancel"].attachClickHandler(std::bind(&cDialog::toast, &chg_dlg, false));
chg_dlg["okay"].attachClickHandler(save_ter_change);
chg_dlg["chance"].attachFocusHandler(std::bind(check_range, _1, _2, _3, 0, 100, "The chance"));
@@ -424,7 +424,7 @@ static bool outdoor_details_event_filter(cDialog& me, std::string, eKeyMod) {
void outdoor_details() {
char temp_str[256];
cDialog out_dlg("edit-outdoor-details.xml");
cDialog out_dlg("edit-outdoor-details");
out_dlg["okay"].attachClickHandler(outdoor_details_event_filter);
snprintf(temp_str,256,"X = %d, Y = %d",cur_out.x,cur_out.y);
out_dlg["loc"].setText(temp_str);
@@ -546,7 +546,7 @@ void edit_out_wand(short mode) {
short which_out_wand = 0;
cOutdoors::cWandering store_out_wand = (mode == 0) ? current_terrain->wandering[0] : current_terrain->special_enc[0];
cDialog wand_dlg("edit-outdoor-encounter.xml");
cDialog wand_dlg("edit-outdoor-encounter");
wand_dlg["cancel"].attachClickHandler(std::bind(&cDialog::toast, &wand_dlg, false));
wand_dlg["endx"].attachFocusHandler(std::bind(check_range_msg, _1, _2, _3, -1, 299, "First part of Stuff Done flag", "-1 if not used"));
@@ -606,7 +606,7 @@ static void put_town_details_in_dlog(cDialog& me) {
void edit_town_details() {
using namespace std::placeholders;
cDialog town_dlg("edit-town-details.xml");
cDialog town_dlg("edit-town-details");
town_dlg["okay"].attachClickHandler(save_town_details);
town_dlg["chop"].attachFocusHandler(std::bind(check_range_msg, _1, _2, _3, -1, 10000, "The day the town becomes abandoned", "-1 if it doesn't"));
town_dlg["key"].attachFocusHandler(std::bind(check_range_msg, _1, _2, _3, -1, 10, "The event which prevents the town from becoming abandoned", "-1 or 0 for none"));
@@ -661,7 +661,7 @@ static bool edit_town_events_event_filter(cDialog& me, std::string item_hit, eKe
void edit_town_events() {
using namespace std::placeholders;
cDialog evt_dlg("edit-town-events.xml");
cDialog evt_dlg("edit-town-events");
evt_dlg["okay"].attachClickHandler(save_town_events);
evt_dlg.attachClickHandlers(edit_town_events_event_filter, {"edit1", "edit2", "edit3", "edit4", "edit5", "edit6", "edit7", "edit8"});
evt_dlg.attachFocusHandlers(std::bind(check_range_msg, _1, _2, _3, -1, 99, "The town special node", "-1 for no special"), {"spec1", "spec2", "spec3", "spec4", "spec5", "spec6", "spec7", "spec8"});
@@ -701,7 +701,7 @@ static void put_advanced_town_in_dlog(cDialog& me) {
void edit_advanced_town() {
using namespace std::placeholders;
cDialog town_dlg("edit-town-advanced.xml");
cDialog town_dlg("edit-town-advanced");
town_dlg["okay"].attachClickHandler(save_advanced_town);
town_dlg["cancel"].attachClickHandler(std::bind(&cDialog::toast, &town_dlg, false));
auto loc_check = std::bind(check_range_msg, _1, _2, _3, -1, 47, "The town exit coordinates", "-1 if you want them ignored");
@@ -759,7 +759,7 @@ static bool edit_town_wand_event_filter(cDialog& me, std::string item_hit, eKeyM
void edit_town_wand() {
using namespace std::placeholders;
cDialog wand_dlg("edit-town-wandering.xml");
cDialog wand_dlg("edit-town-wandering");
wand_dlg["okay"].attachClickHandler(save_town_wand);
auto check_monst = std::bind(check_range_msg, _1, _2, _3, 0, 255, "Wandering monsters", "0 means no monster");
// Just go through and attach the same focus handler to ALL text fields.
@@ -1155,7 +1155,7 @@ location pick_out(location default_loc) {
using namespace std::placeholders;
location prev_loc = default_loc;
cDialog out_dlg("select-sector.xml");
cDialog out_dlg("select-sector");
out_dlg["okay"].attachClickHandler(std::bind(finish_pick_out, _1, true, std::ref(default_loc), prev_loc));
out_dlg["cancel"].attachClickHandler(std::bind(finish_pick_out, _1, false, std::ref(default_loc), prev_loc));
out_dlg.attachClickHandlers(std::bind(pick_out_event_filter, _1, _2, std::ref(default_loc)), {"xplus", "xminus", "yplus", "yminus"});

View File

@@ -546,7 +546,7 @@ bool load_party(fs::path file_to_load, cUniverse& univ){
// the three flags still follow that.
FILE* file_id = fopen(file_to_load.c_str(), "rb");
if(file_id == NULL) {
cChoiceDlog("load-game-fail.xml").show();
cChoiceDlog("load-game-fail").show();
return false;
}
@@ -555,7 +555,7 @@ bool load_party(fs::path file_to_load, cUniverse& univ){
n = fread(&flags, len, 1, file_id);
if(n < 1) {
fclose(file_id);
cChoiceDlog("not-save-game.xml").show();
cChoiceDlog("not-save-game").show();
return false;
}
@@ -634,7 +634,7 @@ bool load_party(fs::path file_to_load, cUniverse& univ){
case new_oboe:
return load_party_v2(file_to_load, univ, town_restore, in_scen, maps_there);
case unknown:
cChoiceDlog("not-save-game.xml").show();
cChoiceDlog("not-save-game").show();
return false;
}
@@ -791,7 +791,7 @@ bool load_party_v2(fs::path file_to_load, cUniverse& univ, bool town_restore, bo
{ // Load main party data first
std::istream& fin = partyIn.getFile("save/party.txt");
if(!fin) {
cChoiceDlog("load-game-fail.xml").show();
cChoiceDlog("load-game-fail").show();
return false;
}
univ.party.readFrom(fin);
@@ -800,7 +800,7 @@ bool load_party_v2(fs::path file_to_load, cUniverse& univ, bool town_restore, bo
{ // Then the "setup" array
std::istream& fin = partyIn.getFile("save/setup.dat");
if(!fin) {
cChoiceDlog("load-game-fail.xml").show();
cChoiceDlog("load-game-fail").show();
return false;
}
uint16_t magic;
@@ -819,7 +819,7 @@ bool load_party_v2(fs::path file_to_load, cUniverse& univ, bool town_restore, bo
fname[7] = i + '1';
std::istream& fin = partyIn.getFile(fname);
if(!fin) {
cChoiceDlog("load-game-fail.xml").show();
cChoiceDlog("load-game-fail").show();
return false;
}
univ.party[i].readFrom(fin);
@@ -830,7 +830,7 @@ bool load_party_v2(fs::path file_to_load, cUniverse& univ, bool town_restore, bo
// Load town data
std::istream& fin = partyIn.getFile("save/town.txt");
if(!fin) {
cChoiceDlog("load-game-fail.xml").show();
cChoiceDlog("load-game-fail").show();
return false;
}
univ.town.readFrom(fin);
@@ -849,7 +849,7 @@ bool load_party_v2(fs::path file_to_load, cUniverse& univ, bool town_restore, bo
// Load outdoors data
std::istream& fin = partyIn.getFile("save/out.txt");
if(!fin) {
cChoiceDlog("load-game-fail.xml").show();
cChoiceDlog("load-game-fail").show();
return false;
}
univ.out.readFrom(fin);