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