1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-11-23 21:07:17 +00:00

fixed issues when failed to load an irregular map

This commit is contained in:
Zeno Rogue 2024-06-02 16:48:07 +02:00
parent 249dff7382
commit 20ce218bec

View File

@ -63,7 +63,7 @@ EX hrmap *base;
EX euc::torus_config_full base_config;
bool gridmaking;
EX bool gridmaking;
int rearrange_index;
@ -918,19 +918,24 @@ EX void load_map_bin(hstream& f) {
EX void load_map_full(hstream& f) {
init();
load_map_bin(f);
while(runlevel < 10) step(1000);
start_game_on_created_map();
try {
load_map_bin(f);
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;
runlevel = 0;
popScreen();
gridmaking = false;
stop_game();
geometry = orig_geometry;
start_game();
}
string irrmapfile = "irregularmap.txt";
@ -984,7 +989,7 @@ void show_gridmaker() {
dialog::addSelItem(XLAT("activate"), runlevel == 10 ? XLAT("ready") : XLAT("wait..."), 'f');
if(runlevel == 10) dialog::add_action(start_game_on_created_map);
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::add_action([] () {
dialog::openFileDialog(irrmapfile, XLAT("irregular to save:"), ".txt", [] () {