mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-03-13 23:18:16 +00:00
nilrider:: user-created levels taken into account in nilrider.save
This commit is contained in:
parent
79720f2863
commit
88b927e4b1
@ -581,7 +581,9 @@ void cleanup_textures() {
|
||||
|
||||
void load_level(const string& fname) {
|
||||
fhstream f(fname, "r");
|
||||
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)} });
|
||||
lev.filename = fname;
|
||||
level *csub = &lev;
|
||||
string s;
|
||||
while(true) {
|
||||
|
@ -129,6 +129,7 @@ struct ghost {
|
||||
|
||||
struct level {
|
||||
string name;
|
||||
string filename;
|
||||
char hotkey;
|
||||
string longdesc;
|
||||
flagtype flags;
|
||||
|
@ -29,6 +29,10 @@ void save() {
|
||||
println(f, "*COLORS\n");
|
||||
println(f, "*RLE\n");
|
||||
for(auto l: all_levels) {
|
||||
if(l->flags & nrlUserCreated) {
|
||||
println(f, "*FILE");
|
||||
println(f, l->filename);
|
||||
}
|
||||
for(auto& p: l->manual_replays) {
|
||||
println(f, "*MANUAL");
|
||||
println(f, l->name);
|
||||
@ -94,6 +98,11 @@ void load() {
|
||||
if(s == "") continue;
|
||||
if(s == "*COLORS") { have_colors = true; continue; }
|
||||
if(s == "*RLE") { have_rle = true; continue; }
|
||||
if(s == "*FILE") {
|
||||
string s1 = scanline_noblank(f);
|
||||
try { load_level(s1); }
|
||||
catch(hr_exception& e) { println(hlog, "error: could not load level ", s1, ", reason: ", e.what()); }
|
||||
}
|
||||
if(s == "*MANUAL") {
|
||||
string lev = scanline_noblank(f);
|
||||
string name = scanline_noblank(f);
|
||||
|
Loading…
x
Reference in New Issue
Block a user