Handle exiting town with multiple entrances

This commit is contained in:
2025-01-21 16:26:56 -06:00
parent ce7c5ed525
commit 145824ea84

View File

@@ -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,8 +1861,25 @@ void handle_editor_screen_shift(int dx, int dy) {
return;
}
}else if(town_entrances.size() > 1){
std::vector<std::string> 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;
}
}
}
cen_x = minmax(min, max, cen_x + dx);