1
0
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:
Zeno Rogue 2024-08-20 18:11:18 +02:00
parent 79720f2863
commit 88b927e4b1
3 changed files with 12 additions and 0 deletions

View File

@ -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) {

View File

@ -129,6 +129,7 @@ struct ghost {
struct level {
string name;
string filename;
char hotkey;
string longdesc;
flagtype flags;

View File

@ -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);