diff --git a/rsrc/dialogs/edit-town-wandering.xml b/rsrc/dialogs/edit-town-wandering.xml
index 64ba131a..06214166 100644
--- a/rsrc/dialogs/edit-town-wandering.xml
+++ b/rsrc/dialogs/edit-town-wandering.xml
@@ -2,29 +2,34 @@
diff --git a/src/scenedit/scen.actions.cpp b/src/scenedit/scen.actions.cpp
index c44d03c7..71e08a85 100644
--- a/src/scenedit/scen.actions.cpp
+++ b/src/scenedit/scen.actions.cpp
@@ -86,7 +86,7 @@ ePalBtn out_buttons[6][10] = {
ePalBtn town_buttons[6][10] = {
{PAL_PENCIL, PAL_BRUSH_LG, PAL_BRUSH_SM, PAL_SPRAY_LG, PAL_SPRAY_SM, PAL_ERASER, PAL_RECT_HOLLOW, PAL_RECT_FILLED, PAL_BUCKET, PAL_DROPPER},
- {PAL_ENTER_N, PAL_ENTER_W, PAL_ENTER_S, PAL_ENTER_E, PAL_TOWN_BORDER, PAL_EDIT_SIGN, PAL_TEXT_AREA, PAL_WANDER, PAL_START, PAL_ZOOM},
+ {PAL_ENTER_N, PAL_ENTER_W, PAL_ENTER_S, PAL_ENTER_E, PAL_TOWN_BORDER, PAL_EDIT_SIGN, PAL_TEXT_AREA, PAL_BLANK, PAL_START, PAL_ZOOM},
{PAL_SPEC, PAL_COPY_SPEC, PAL_ERASE_SPEC, PAL_EDIT_SPEC, PAL_SPEC_SPOT, PAL_BOAT, PAL_HORSE, PAL_COPY_TER, PAL_CHANGE, PAL_TERRAIN},
{PAL_ROAD, PAL_WEB, PAL_CRATE, PAL_BARREL, PAL_BLOCK, PAL_EDIT_STORAGE, PAL_EDIT_ITEM, PAL_COPY_ITEM, PAL_ERASE_ITEM, PAL_ITEM},
{PAL_FIRE_BARR, PAL_FORCE_BARR, PAL_QUICKFIRE, PAL_FORCECAGE, PAL_BLANK, PAL_PASTE, PAL_EDIT_MONST, PAL_COPY_MONST, PAL_ERASE_MONST, PAL_MONST},
@@ -834,6 +834,7 @@ static bool handle_terrain_action(location the_point, bool ctrl_hit) {
}
overall_mode = MODE_DRAWING;
break;
+ // Deprecated:
case MODE_SET_WANDER_POINTS:
if(mouse_button_held)
break;
diff --git a/src/scenedit/scen.global.hpp b/src/scenedit/scen.global.hpp
index 435fdbd6..b2a15e65 100644
--- a/src/scenedit/scen.global.hpp
+++ b/src/scenedit/scen.global.hpp
@@ -29,6 +29,7 @@ const int TYPE_ROWS_EDITING = 23;
enum eScenMode {
MODE_DRAWING = 0,
MODE_TOGGLE_ROAD = 1,
+ // Deprecated. Use the location picker in the encounter editor dialog.
MODE_SET_WANDER_POINTS = 2,
MODE_ROOM_RECT = 3,
MODE_PLACE_ITEM = 4,
diff --git a/src/scenedit/scen.townout.cpp b/src/scenedit/scen.townout.cpp
index de22cef7..c5048b5a 100644
--- a/src/scenedit/scen.townout.cpp
+++ b/src/scenedit/scen.townout.cpp
@@ -1019,17 +1019,19 @@ static bool save_town_wand(cDialog& me, std::string, eKeyMod) {
std::string id = base_id + std::to_string(j + 1);
town->wandering[i].monst[j] = me[id].getTextAsNum();
}
+ town->wandering_locs[i] = boost::lexical_cast(me["group" + std::to_string(i+1) + "-loc"].getText());
}
return true;
}
static void put_town_wand_in_dlog(cDialog& me) {
for(int i = 0; i < town->wandering.size(); i++) {
- std::string base_id = "group" + std::to_string(i + 1) + "-monst";
+ std::string base_id = "group" + std::to_string(i + 1);
for(int j = 0; j < 4; j++) {
- std::string id = base_id + std::to_string(j + 1);
+ std::string id = base_id + "-monst" + std::to_string(j + 1);
me[id].setTextToNum(town->wandering[i].monst[j]);
}
+ me[base_id + "-loc"].setText(boost::lexical_cast(town->wandering_locs[i]));
}
}
@@ -1040,12 +1042,17 @@ static bool edit_town_wand_event_filter(cDialog& me, std::string item_hit, eKeyM
"Choose Third Monster: (1 appears)",
"Choose Fourth Monster: (1-2 appears)",
};
- short group = item_hit[6] - '0';
- std::string base_id = "group" + std::to_string(group) + "-monst";
- for(int i = 0; i < 4; i++) {
- std::string id = base_id + std::to_string(i + 1);
+ short group = item_hit[4] - '0';
+ std::string base_id = "group" + std::to_string(group);
+ if(item_hit.substr(5) == "-loc"){
+ std::string id = base_id + "-loc";
+ location current = boost::lexical_cast(me[id].getText());
+ current = cLocationPicker(current, *town, "Choose wandering group " + std::to_string(group) + " location", &me).run();
+ me[id].setText(boost::lexical_cast(current));
+ }else{
+ short i = item_hit[11] - '1';
+ std::string id = base_id + "-monst" + std::to_string(i + 1);
short n = choose_text(STRT_MONST, town->wandering[group].monst[i] - 1, &me, titles[i]) + 1;
- if(n == town->wandering[group].monst[i]) break;
me[id].setTextToNum(n);
}
return true;
@@ -1055,17 +1062,17 @@ void edit_town_wand() {
using namespace std::placeholders;
cDialog wand_dlg(*ResMgr::dialogs.get("edit-town-wandering"));
- wand_dlg["okay"].attachClickHandler(save_town_wand);
- wand_dlg["cancel"].attachClickHandler(std::bind(&cDialog::toast, &wand_dlg, false));
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.
// There's 16 of them, so this is kinda the easiest way to do it.
wand_dlg.forEach([&check_monst](std::string, cControl& ctrl) {
if(ctrl.getType() == CTRL_FIELD)
ctrl.attachFocusHandler(check_monst);
- else if(ctrl.getText() == "Choose")
+ else if(ctrl.getType() == CTRL_BTN)
ctrl.attachClickHandler(edit_town_wand_event_filter);
});
+ wand_dlg["okay"].attachClickHandler(save_town_wand);
+ wand_dlg["cancel"].attachClickHandler(std::bind(&cDialog::toast, &wand_dlg, false));
put_town_wand_in_dlog(wand_dlg);