mirror of
https://github.com/zenorogue/hyperrogue.git
synced 2025-01-26 00:47:00 +00:00
cheat_if_confirmed now auto-disables while in a forbidden-cheat mode
This commit is contained in:
parent
5238959cbd
commit
8f0f224605
14
dialogs.cpp
14
dialogs.cpp
@ -1246,6 +1246,18 @@ EX namespace dialog {
|
|||||||
dialog::add_action([&b] { b = !b; });
|
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
|
#if HDR
|
||||||
|
|
||||||
template<class T> void addBoolItem_choice(const string& s, T& b, T val, char c) {
|
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) {
|
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); });
|
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();
|
else act();
|
||||||
}
|
}
|
||||||
|
@ -418,12 +418,7 @@ EX void showCreative() {
|
|||||||
#if CAP_EDIT
|
#if CAP_EDIT
|
||||||
dialog::addItem(XLAT("map editor"), 'm');
|
dialog::addItem(XLAT("map editor"), 'm');
|
||||||
dialog::add_action([] {
|
dialog::add_action([] {
|
||||||
if(tactic::on)
|
dialog::cheat_if_confirmed([] {
|
||||||
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([] {
|
|
||||||
cheater++;
|
cheater++;
|
||||||
pushScreen(mapeditor::showMapEditor);
|
pushScreen(mapeditor::showMapEditor);
|
||||||
lastexplore = turncount;
|
lastexplore = turncount;
|
||||||
|
Loading…
Reference in New Issue
Block a user