prompt to go to town's entrance in the outdoors
This commit is contained in:
11
rsrc/dialogs/shift-town-entrance.xml
Normal file
11
rsrc/dialogs/shift-town-entrance.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
|
||||
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
|
||||
<dialog defbtn='no'>
|
||||
<button name='no' type='regular' def-key='n' top='39' left='244'>No</button>
|
||||
<button name='yes' type='regular' def-key='y' top='39' left='178'>Yes</button>
|
||||
<pict type='dlog' num='11' top='9' left='9'/>
|
||||
<text top='4' left='51' width='251' height='32'>
|
||||
Shift to this town's entrance in this outdoor section?
|
||||
</text>
|
||||
<text name='out-sec' relative='pos-in pos' rel-anchor='prev' top='4' left='0'></text>
|
||||
</dialog>
|
@@ -5,6 +5,7 @@
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <stack>
|
||||
#include <vector>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#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_entrance_t> 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<std::string>(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);
|
||||
|
Reference in New Issue
Block a user