@@ -5,8 +5,7 @@
|
||||
<button name='no' type='regular' def-key='n' top='39' left='178'>No</button>
|
||||
<button name='yes' type='regular' def-key='y' top='39' left='244'>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 name='prompt' top='4' left='51' width='251' height='32'>
|
||||
Shift to this town's entrance in outdoor section {sec} at {loc} ({loc_str})?
|
||||
</text>
|
||||
<text name='out-sec' relative='pos-in pos' rel-anchor='prev' top='4' left='0'></text>
|
||||
</dialog>
|
||||
|
@@ -54,6 +54,17 @@ public:
|
||||
bool is_on_map(location loc) const {
|
||||
return loc.x < max_dim && loc.y < max_dim && loc.x >= 0 && loc.y >= 0;
|
||||
}
|
||||
|
||||
std::string loc_str(location where) {
|
||||
std::string str = name;
|
||||
for(info_rect_t rect : area_desc){
|
||||
if(!rect.empty() && rect.contains(where)){
|
||||
str += ": " + rect.descr;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -2335,7 +2335,10 @@ void handle_editor_screen_shift(int dx, int dy) {
|
||||
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));
|
||||
cControl& text = shift_prompt->getControl("prompt");
|
||||
text.replaceText("{sec}", boost::lexical_cast<std::string>(only_entrance.out_sec));
|
||||
text.replaceText("{loc}", boost::lexical_cast<std::string>(only_entrance.loc));
|
||||
text.replaceText("{loc_str}", scenario.outdoors[only_entrance.out_sec.x][only_entrance.out_sec.y]->loc_str(only_entrance.loc));
|
||||
|
||||
if(shift_prompt.show() == "yes"){
|
||||
set_current_out(only_entrance.out_sec, true);
|
||||
@@ -2350,9 +2353,9 @@ void handle_editor_screen_shift(int dx, int dy) {
|
||||
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;
|
||||
sstr << "Entrance in section " << entrance.out_sec << " at " << entrance.loc
|
||||
<< " (" <<scenario.outdoors[entrance.out_sec.x][entrance.out_sec.y]->loc_str(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);
|
||||
|
Reference in New Issue
Block a user