1
0
mirror of https://github.com/zenorogue/hyperrogue.git synced 2024-06-18 11:19:59 +00:00

cheat_if_confirmed now auto-disables while in a forbidden-cheat mode

This commit is contained in:
Zeno Rogue 2020-05-31 16:43:36 +02:00
parent 5238959cbd
commit 8f0f224605
2 changed files with 15 additions and 6 deletions

View File

@ -1246,6 +1246,18 @@ EX namespace dialog {
dialog::add_action([&b] { b = !b; });
}
EX bool cheat_forbidden() {
if(tactic::on && !cheater) {
addMessage(XLAT("Not available in the pure tactics mode!"));
return true;
}
if(daily::on) {
addMessage(XLAT("Not available in the daily challenge!"));
return true;
}
return false;
}
#if HDR
template<class T> void addBoolItem_choice(const string& s, T& b, T val, char c) {
@ -1254,6 +1266,8 @@ EX namespace dialog {
}
inline void cheat_if_confirmed(const reaction_t& act) {
if(cheat_forbidden())
return;
if(needConfirmationEvenIfSaved()) pushScreen([act] () { confirm_dialog(XLAT("This will enable the cheat mode, making this game ineligible for scoring. Are you sure?"), act); });
else act();
}

View File

@ -418,12 +418,7 @@ EX void showCreative() {
#if CAP_EDIT
dialog::addItem(XLAT("map editor"), 'm');
dialog::add_action([] {
if(tactic::on)
addMessage(XLAT("Not available in the pure tactics mode!"));
else if(daily::on) {
addMessage(XLAT("Not available in the daily challenge!"));
}
else dialog::cheat_if_confirmed([] {
dialog::cheat_if_confirmed([] {
cheater++;
pushScreen(mapeditor::showMapEditor);
lastexplore = turncount;