mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-03-21 10:57:03 +00:00
nilrider:: CAP_SAVE guards
This commit is contained in:
parent
3ac690434d
commit
20ebc8b488
@ -379,6 +379,7 @@ template<class T, class U> void replays_of_type(vector<T>& v, const U& loader) {
|
||||
}
|
||||
}
|
||||
|
||||
#if CAP_SAVE
|
||||
void replays() {
|
||||
dialog::init(XLAT(planning_mode ? "saved plans" : "replays"), 0xC0C0FFFF, 150, 100);
|
||||
if(!planning_mode) replays_of_type(curlev->manual_replays, [] (manual_replay& r) {
|
||||
@ -411,6 +412,7 @@ void pop_and_push_replays() {
|
||||
popScreen();
|
||||
pushScreen(replays);
|
||||
}
|
||||
#endif
|
||||
|
||||
reaction_t on_quit = [] { exit(0); };
|
||||
|
||||
@ -432,6 +434,7 @@ void main_menu() {
|
||||
dialog::addItem("view the replay", 'v');
|
||||
dialog::add_action(toggle_replay);
|
||||
|
||||
#if CAP_SAVE
|
||||
dialog::addItem("save the replay", 's');
|
||||
dialog::add_action([] {
|
||||
vector<int> ang;
|
||||
@ -442,8 +445,10 @@ void main_menu() {
|
||||
|
||||
dialog::addItem("load a replay", 'l');
|
||||
dialog::add_action(pop_and_push_replays);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#if CAP_SAVE
|
||||
dialog::addItem("save this plan", 's');
|
||||
dialog::add_action([] {
|
||||
curlev->plan_replays.emplace_back(plan_replay{new_replay_name(), curlev->plan});
|
||||
@ -452,6 +457,7 @@ void main_menu() {
|
||||
|
||||
dialog::addItem("load a plan", 'l');
|
||||
dialog::add_action(pop_and_push_replays);
|
||||
#endif
|
||||
}
|
||||
|
||||
dialog::addItem("track / mode / goals", 't');
|
||||
|
@ -11,6 +11,7 @@ string new_replay_name() {
|
||||
}
|
||||
|
||||
void save() {
|
||||
#if CAP_SAVE
|
||||
println(hlog, "save called");
|
||||
fhstream f("nilrider.save", "wt");
|
||||
println(f, "NilRider version ", ver);
|
||||
@ -43,6 +44,7 @@ void save() {
|
||||
println(f);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
level *level_by_name(string s) {
|
||||
@ -52,6 +54,7 @@ level *level_by_name(string s) {
|
||||
}
|
||||
|
||||
void load() {
|
||||
#if CAP_SAVE
|
||||
println(hlog, "load called");
|
||||
fhstream f("nilrider.save", "rt");
|
||||
if(!f.f) return;
|
||||
@ -99,6 +102,7 @@ void load() {
|
||||
}
|
||||
println(hlog, "error: unknown content ", s);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user