mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-15 19:55:47 +00:00
nilrider:: do not switch level on saving a usergen level
This commit is contained in:
parent
88b927e4b1
commit
da5ba2bf2b
@ -579,7 +579,7 @@ void cleanup_textures() {
|
|||||||
cleanup_texture(castle_texture);
|
cleanup_texture(castle_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void load_level(const string& fname) {
|
void load_level(const string& fname, bool init) {
|
||||||
fhstream f(fname, "r");
|
fhstream f(fname, "r");
|
||||||
if(!f.f) throw hr_exception("could not open file ");
|
if(!f.f) throw hr_exception("could not open file ");
|
||||||
level lev("Untitled", '1', nrlUserCreated, "", -1, 1, 1, -1, {}, 0, 0, {}, rot_plane, { goal{0x40FF40, "Collect all the triangles", basic_check(999, 999)} });
|
level lev("Untitled", '1', nrlUserCreated, "", -1, 1, 1, -1, {}, 0, 0, {}, rot_plane, { goal{0x40FF40, "Collect all the triangles", basic_check(999, 999)} });
|
||||||
@ -659,10 +659,12 @@ void load_level(const string& fname) {
|
|||||||
}
|
}
|
||||||
else throw hr_exception("cannot use the same name as an official level");
|
else throw hr_exception("cannot use the same name as an official level");
|
||||||
}
|
}
|
||||||
|
if(init) {
|
||||||
curlev = new level(lev);
|
curlev = new level(lev);
|
||||||
all_levels.emplace_back(curlev);
|
all_levels.emplace_back(curlev);
|
||||||
if(on) curlev->init();
|
if(on) curlev->init();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ void pick_level() {
|
|||||||
dialog::add_action([] {
|
dialog::add_action([] {
|
||||||
dialog::openFileDialog(fname, XLAT("level to load:"), ".nrl", [] () {
|
dialog::openFileDialog(fname, XLAT("level to load:"), ".nrl", [] () {
|
||||||
try {
|
try {
|
||||||
load_level(fname);
|
load_level(fname, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
catch(hr_exception& e) {
|
catch(hr_exception& e) {
|
||||||
@ -771,7 +771,7 @@ auto celldemo = arg::add3("-unilcycle", initialize) + arg::add3("-unilplan", []
|
|||||||
if(on) curlev->init();
|
if(on) curlev->init();
|
||||||
})
|
})
|
||||||
+ arg::add3("-load-level", [] {
|
+ arg::add3("-load-level", [] {
|
||||||
arg::shift(); load_level(arg::args());
|
arg::shift(); load_level(arg::args(), true);
|
||||||
})
|
})
|
||||||
+ arg::add3("-simplemodel", [] {
|
+ arg::add3("-simplemodel", [] {
|
||||||
nisot::geodesic_movement = false;
|
nisot::geodesic_movement = false;
|
||||||
|
@ -100,7 +100,7 @@ void load() {
|
|||||||
if(s == "*RLE") { have_rle = true; continue; }
|
if(s == "*RLE") { have_rle = true; continue; }
|
||||||
if(s == "*FILE") {
|
if(s == "*FILE") {
|
||||||
string s1 = scanline_noblank(f);
|
string s1 = scanline_noblank(f);
|
||||||
try { load_level(s1); }
|
try { load_level(s1, false); }
|
||||||
catch(hr_exception& e) { println(hlog, "error: could not load level ", s1, ", reason: ", e.what()); }
|
catch(hr_exception& e) { println(hlog, "error: could not load level ", s1, ", reason: ", e.what()); }
|
||||||
}
|
}
|
||||||
if(s == "*MANUAL") {
|
if(s == "*MANUAL") {
|
||||||
|
Loading…
Reference in New Issue
Block a user