1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2025-10-31 22:12:59 +00:00

nilrider:: basic save functionality (no load though)

This commit is contained in:
Zeno Rogue
2022-05-01 16:45:18 +02:00
parent 3072a998ba
commit 62331b43f1
3 changed files with 61 additions and 2 deletions

View File

@@ -5,6 +5,7 @@
#include "level.cpp"
#include "planning.cpp"
#include "solver.cpp"
#include "save.cpp"
namespace nilrider {
@@ -254,13 +255,19 @@ void main_menu() {
dialog::addItem("view the replay", 'v');
dialog::add_action(toggle_replay);
dialog::addItem("save the replay", 'e');
dialog::addItem("save the replay", 's');
dialog::add_action([] {
vector<int> ang;
for(auto& h: curlev->history) ang.push_back(heading_to_int(h.heading_angle));
curlev->manual_replays.emplace_back(manual_replay{new_replay_name(), std::move(ang)});
save();
});
}
else {
dialog::addItem("save this plan", 's');
dialog::add_action([] {
curlev->plan_replays.emplace_back(plan_replay{new_replay_name(), curlev->plan});
save();
});
}