diff --git a/rsrc/dialogs/select-town-edit.xml b/rsrc/dialogs/select-town-edit.xml index 7e2203dc..c9baa9ed 100644 --- a/rsrc/dialogs/select-town-edit.xml +++ b/rsrc/dialogs/select-town-edit.xml @@ -3,12 +3,13 @@ - - + + Pick Town to Edit: Enter the number of the town you want to edit next: + diff --git a/rsrc/dialogs/select-town-enter.xml b/rsrc/dialogs/select-town-enter.xml index 284831ab..89c023ea 100644 --- a/rsrc/dialogs/select-town-enter.xml +++ b/rsrc/dialogs/select-town-enter.xml @@ -3,12 +3,13 @@ - - + + Entrance to what town? What town do you want the party to end up in when they walk into this space? + diff --git a/src/game/boe.graphics.cpp b/src/game/boe.graphics.cpp index 6fda4fb1..4eee58b2 100644 --- a/src/game/boe.graphics.cpp +++ b/src/game/boe.graphics.cpp @@ -814,12 +814,13 @@ void draw_terrain(short mode) { if((can_draw != 0) && (overall_mode != MODE_RESTING)) { // if can see, not a pit, and not resting if(is_combat()) anim_ticks = 0; - eTrimType trim = univ.get_terrain(spec_terrain).trim_type; + auto const &terrain=univ.get_terrain(spec_terrain); + eTrimType trim = terrain.trim_type; // Finally, draw this terrain spot if(trim == eTrimType::WALKWAY){ int trim = -1; - unsigned short ground_t = univ.get_terrain(spec_terrain).trim_ter; + unsigned short ground_t = terrain.trim_ter; ter_num_t ground_ter = univ.scenario.get_ter_from_ground(ground_t); if(!loc_off_act_area(where_draw)) { if(is_nature(where_draw.x - 1,where_draw.y,ground_t)){ // check left diff --git a/src/scenedit/scen.townout.cpp b/src/scenedit/scen.townout.cpp index c83e22fc..46d6c135 100644 --- a/src/scenedit/scen.townout.cpp +++ b/src/scenedit/scen.townout.cpp @@ -381,13 +381,24 @@ static bool save_town_num(cDialog& me, std::string, eKeyMod) { return true; } +static bool check_range_and_update_town_name(cDialog& me,std::string id,bool losing,std::vector const &towns) +{ + if (!check_range_msg(me, id, losing, 0, long(towns.size())-1, "Town number", "")) { + me["name"].setText(""); + return false; + } + int i = me["town"].getTextAsNum(); + me["name"].setText((i>=0 && iname : ""); + return true; +} + short pick_town_num(std::string which_dlog,short def,cScenario& scenario) { using namespace std::placeholders; cDialog town_dlg(which_dlog); town_dlg["cancel"].attachClickHandler(std::bind(&cDialog::toast, &town_dlg, false)); town_dlg["okay"].attachClickHandler(save_town_num); - town_dlg["town"].attachFocusHandler(std::bind(check_range, _1, _2, _3, 0, scenario.towns.size() - 1, "Town number")); + town_dlg["town"].attachFocusHandler(std::bind(check_range_and_update_town_name, _1, _2, _3, scenario.towns)); town_dlg["choose"].attachClickHandler([&scenario](cDialog& me, std::string, eKeyMod) -> bool { int i = me["town"].getTextAsNum(); if(&scenario != &::scenario) @@ -396,10 +407,13 @@ short pick_town_num(std::string which_dlog,short def,cScenario& scenario) { if(&scenario != &::scenario) scenario.towns.swap(::scenario.towns); me["town"].setTextToNum(i); + me["name"].setText((i>=0 && iname : ""); return true; }); town_dlg["town"].setTextToNum(def); + if (def>=0 && defname); std::string prompt = town_dlg["prompt"].getText(); prompt += " (0 - " + std::to_string(scenario.towns.size() - 1) + ')'; town_dlg["prompt"].setText(prompt);