mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-02-03 04:39:17 +00:00
nilrider:: full interface for loading ghosts
This commit is contained in:
parent
4f27a969e4
commit
beecfa9f94
@ -458,12 +458,12 @@ void settings() {
|
|||||||
dialog::display();
|
dialog::display();
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T, class U> void replays_of_type(vector<T>& v, const U& loader) {
|
template<class T, class U, class V> void replays_of_type(vector<T>& v, const U& loader, const V& ghost_loader) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(auto& r: v) {
|
for(auto& r: v) {
|
||||||
dialog::addItem(r.name, 'a');
|
dialog::addItem(r.name, 'a');
|
||||||
dialog::add_action([&v, i, loader] {
|
dialog::add_action([&v, i, loader, ghost_loader] {
|
||||||
pushScreen([&v, i, loader] {
|
pushScreen([&v, i, loader, ghost_loader] {
|
||||||
dialog::init(XLAT(planning_mode ? "saved plan" : "replay"), 0xC0C0FFFF, 150, 100);
|
dialog::init(XLAT(planning_mode ? "saved plan" : "replay"), 0xC0C0FFFF, 150, 100);
|
||||||
dialog::addInfo(v[i].name);
|
dialog::addInfo(v[i].name);
|
||||||
|
|
||||||
@ -471,7 +471,7 @@ template<class T, class U> void replays_of_type(vector<T>& v, const U& loader) {
|
|||||||
dialog::add_action([&v, i, loader] { popScreen(); loader(v[i]); });
|
dialog::add_action([&v, i, loader] { popScreen(); loader(v[i]); });
|
||||||
|
|
||||||
dialog::addItem(planning_mode ? "load plan as ghost" : "load replay as ghost", 'g');
|
dialog::addItem(planning_mode ? "load plan as ghost" : "load replay as ghost", 'g');
|
||||||
dialog::add_action([] { popScreen(); println(hlog, "not implemented"); });
|
dialog::add_action([&v, i, ghost_loader] { popScreen(); ghost_loader(v[i]); });
|
||||||
|
|
||||||
dialog::addItem("rename", 'r');
|
dialog::addItem("rename", 'r');
|
||||||
dialog::add_action([&v, i] {
|
dialog::add_action([&v, i] {
|
||||||
@ -506,13 +506,23 @@ void replays() {
|
|||||||
curlev->history = curlev->headings_to_history(r);
|
curlev->history = curlev->headings_to_history(r);
|
||||||
toggle_replay();
|
toggle_replay();
|
||||||
popScreen();
|
popScreen();
|
||||||
});
|
}, [] (manual_replay& r) { curlev->load_manual_as_ghost(r); });
|
||||||
if(planning_mode) replays_of_type(curlev->plan_replays, [] (plan_replay& r) {
|
if(planning_mode) replays_of_type(curlev->plan_replays, [] (plan_replay& r) {
|
||||||
view_replay = false;
|
view_replay = false;
|
||||||
curlev->history.clear();
|
curlev->history.clear();
|
||||||
curlev->plan = r.plan;
|
curlev->plan = r.plan;
|
||||||
popScreen();
|
popScreen();
|
||||||
});
|
}, [] (plan_replay& r) { curlev->load_plan_as_ghost(r); });
|
||||||
|
dialog::addBreak(100);
|
||||||
|
if(isize(curlev->ghosts)) {
|
||||||
|
dialog::addSelItem("forget all ghosts", its(isize(curlev->ghosts)), 'G');
|
||||||
|
dialog::add_action([] { curlev->ghosts.clear(); });
|
||||||
|
}
|
||||||
|
else if(isize(curlev->manual_replays) || isize(curlev->plan_replays)) {
|
||||||
|
dialog::addSelItem("load all plans and replays as ghosts", its(isize(curlev->manual_replays) + isize(curlev->plan_replays)), 'G');
|
||||||
|
dialog::add_action([] { curlev->load_all_ghosts(); });
|
||||||
|
}
|
||||||
|
else dialog::addBreak(100);
|
||||||
dialog::addBack();
|
dialog::addBack();
|
||||||
dialog::display();
|
dialog::display();
|
||||||
}
|
}
|
||||||
@ -779,8 +789,7 @@ auto celldemo = arg::add3("-unilcycle", initialize) + arg::add3("-unilplan", []
|
|||||||
pconf.rotational_nil = 0;
|
pconf.rotational_nil = 0;
|
||||||
})
|
})
|
||||||
+ arg::add3("-ghost-all", [] {
|
+ arg::add3("-ghost-all", [] {
|
||||||
for(auto& g: curlev->plan_replays) curlev->load_plan_as_ghost(g);
|
curlev->load_all_ghosts();
|
||||||
for(auto& g: curlev->manual_replays) curlev->load_manual_as_ghost(g);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
auto hook0= addHook(hooks_configfile, 300, default_settings);
|
auto hook0= addHook(hooks_configfile, 300, default_settings);
|
||||||
|
@ -249,6 +249,7 @@ struct level {
|
|||||||
vector<timestamp> headings_to_history(manual_replay&);
|
vector<timestamp> headings_to_history(manual_replay&);
|
||||||
void load_plan_as_ghost(plan_replay&);
|
void load_plan_as_ghost(plan_replay&);
|
||||||
void load_manual_as_ghost(manual_replay&);
|
void load_manual_as_ghost(manual_replay&);
|
||||||
|
void load_all_ghosts();
|
||||||
};
|
};
|
||||||
|
|
||||||
/** wheel radius */
|
/** wheel radius */
|
||||||
|
@ -202,4 +202,9 @@ void save_manual_replay() {
|
|||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void level::load_all_ghosts() {
|
||||||
|
for(auto& g: plan_replays) load_plan_as_ghost(g);
|
||||||
|
for(auto& g: manual_replays) load_manual_as_ghost(g);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user