From 145824ea84e5dcc86083bd2bf584a2d0cf9c1f2e Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Tue, 21 Jan 2025 16:26:56 -0600 Subject: [PATCH] Handle exiting town with multiple entrances --- src/scenedit/scen.actions.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/scenedit/scen.actions.cpp b/src/scenedit/scen.actions.cpp index 21a369b3..38e3cd38 100644 --- a/src/scenedit/scen.actions.cpp +++ b/src/scenedit/scen.actions.cpp @@ -25,6 +25,7 @@ #include "tools/cursors.hpp" #include "dialogxml/widgets/scrollbar.hpp" #include "dialogxml/dialogs/strdlog.hpp" +#include "dialogxml/dialogs/strchoice.hpp" #include "dialogxml/dialogs/choicedlog.hpp" #ifndef MSBUILD_GITREV #include "tools/gitrev.hpp" @@ -1860,7 +1861,24 @@ void handle_editor_screen_shift(int dx, int dy) { return; } }else if(town_entrances.size() > 1){ + std::vector entrance_strings; + for(town_entrance_t entrance : town_entrances){ + std::ostringstream sstr; + sstr << "Entrance in section " << entrance.out_sec << " at " << entrance.loc; + entrance_strings.push_back(sstr.str()); + } + cStringChoice dlog(entrance_strings, "Shift to one of this town's entrances in the outdoors?"); + size_t choice = dlog.show(-1); + if(choice >= 0 && choice < town_entrances.size()){ + town_entrance_t entrance = town_entrances[choice]; + set_current_out(entrance.out_sec); + start_out_edit(); + cen_x = entrance.loc.x; + cen_y = entrance.loc.y; + redraw_screen(); + return; + } } }