mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2024-11-17 18:54:48 +00:00
fixed issues when failed to load an irregular map
This commit is contained in:
parent
249dff7382
commit
20ce218bec
@ -63,7 +63,7 @@ EX hrmap *base;
|
|||||||
|
|
||||||
EX euc::torus_config_full base_config;
|
EX euc::torus_config_full base_config;
|
||||||
|
|
||||||
bool gridmaking;
|
EX bool gridmaking;
|
||||||
|
|
||||||
int rearrange_index;
|
int rearrange_index;
|
||||||
|
|
||||||
@ -918,19 +918,24 @@ EX void load_map_bin(hstream& f) {
|
|||||||
|
|
||||||
EX void load_map_full(hstream& f) {
|
EX void load_map_full(hstream& f) {
|
||||||
init();
|
init();
|
||||||
load_map_bin(f);
|
try {
|
||||||
while(runlevel < 10) step(1000);
|
load_map_bin(f);
|
||||||
start_game_on_created_map();
|
while(runlevel < 10) step(1000);
|
||||||
|
start_game_on_created_map();
|
||||||
|
}
|
||||||
|
catch(hr_exception& e) {
|
||||||
|
cancel_map_creation();
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void cancel_map_creation() {
|
EX void cancel_map_creation() {
|
||||||
base = NULL;
|
base = NULL;
|
||||||
runlevel = 0;
|
runlevel = 0;
|
||||||
popScreen();
|
popScreen();
|
||||||
gridmaking = false;
|
gridmaking = false;
|
||||||
stop_game();
|
stop_game();
|
||||||
geometry = orig_geometry;
|
geometry = orig_geometry;
|
||||||
start_game();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
string irrmapfile = "irregularmap.txt";
|
string irrmapfile = "irregularmap.txt";
|
||||||
@ -984,7 +989,7 @@ void show_gridmaker() {
|
|||||||
dialog::addSelItem(XLAT("activate"), runlevel == 10 ? XLAT("ready") : XLAT("wait..."), 'f');
|
dialog::addSelItem(XLAT("activate"), runlevel == 10 ? XLAT("ready") : XLAT("wait..."), 'f');
|
||||||
if(runlevel == 10) dialog::add_action(start_game_on_created_map);
|
if(runlevel == 10) dialog::add_action(start_game_on_created_map);
|
||||||
dialog::addItem(XLAT("cancel"), 'c');
|
dialog::addItem(XLAT("cancel"), 'c');
|
||||||
dialog::add_action(cancel_map_creation);
|
dialog::add_action([] { cancel_map_creation(); start_game(); });
|
||||||
dialog::addItem(XLAT("save"), 's');
|
dialog::addItem(XLAT("save"), 's');
|
||||||
dialog::add_action([] () {
|
dialog::add_action([] () {
|
||||||
dialog::openFileDialog(irrmapfile, XLAT("irregular to save:"), ".txt", [] () {
|
dialog::openFileDialog(irrmapfile, XLAT("irregular to save:"), ".txt", [] () {
|
||||||
|
Loading…
Reference in New Issue
Block a user