From e303363900e78ea8eb1662bd1df014c2c9a94d4e Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Tue, 21 Jan 2025 16:02:37 -0600 Subject: [PATCH] prompt to go to town's entrance in the outdoors --- rsrc/dialogs/shift-town-entrance.xml | 11 +++++++++++ src/scenedit/scen.actions.cpp | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100644 rsrc/dialogs/shift-town-entrance.xml diff --git a/rsrc/dialogs/shift-town-entrance.xml b/rsrc/dialogs/shift-town-entrance.xml new file mode 100644 index 00000000..5303905e --- /dev/null +++ b/rsrc/dialogs/shift-town-entrance.xml @@ -0,0 +1,11 @@ + + + + + + + + Shift to this town's entrance in this outdoor section? + + + diff --git a/src/scenedit/scen.actions.cpp b/src/scenedit/scen.actions.cpp index b4f1e1ed..21a369b3 100644 --- a/src/scenedit/scen.actions.cpp +++ b/src/scenedit/scen.actions.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include "scen.global.hpp" #include "scenario/scenario.hpp" @@ -1844,7 +1845,23 @@ void handle_editor_screen_shift(int dx, int dy) { if(out_of_bounds){ // In town, prompt whether to go back to outdoor entrance location + std::vector town_entrances = scenario.find_town_entrances(cur_town); + if(town_entrances.size() == 1){ + town_entrance_t only_entrance = town_entrances[0]; + cChoiceDlog shift_prompt("shift-town-entrance", {"yes", "no"}); + shift_prompt->getControl("out-sec").setText(boost::lexical_cast(only_entrance.out_sec)); + if(shift_prompt.show() == "yes"){ + set_current_out(only_entrance.out_sec); + start_out_edit(); + cen_x = only_entrance.loc.x; + cen_y = only_entrance.loc.y; + redraw_screen(); + return; + } + }else if(town_entrances.size() > 1){ + + } } cen_x = minmax(min, max, cen_x + dx);