1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2026-03-12 16:19:43 +00:00

ru:: save timed orbs

This commit is contained in:
Zeno Rogue
2025-12-12 23:59:43 +01:00
parent ffbf2400dd
commit 686d026dd1

View File

@@ -70,6 +70,8 @@ void save_as(string fname) {
println(f, "AT ", y, " ", x, " ", r.block_at[y][x]);
for(auto& e: r.entities) save_via_stater(f, *e, "ENTITY");
if(r.timed_orb_end >= gframeid) println(f, "TIMER ", r.timed_orb_end);
println(f);
}
@@ -181,6 +183,10 @@ void load_from(string fname) {
sscanf(param.c_str(), "%d%d%d", &x, &y, &c);
current_room->block_at[y][x] = c;
}
else if(cap == "TIMER") {
if(!current_room) { println(hlog, "warning: no current room"); continue; }
current_room->timed_orb_end = atoi(param.c_str());
}
else if(cap == "ENTITY") {
if(!current_room) { println(hlog, "warning: no current room"); continue; }
auto add = [&] (std::unique_ptr<entity>&& e) { current_room->entities.emplace_back(std::move(e)); current_entity = &*(current_room->entities.back()); };