From 96488d27c8f1d2bbd021c683adb99fc5dd5c75e8 Mon Sep 17 00:00:00 2001 From: Misa Date: Mon, 3 May 2021 18:22:59 -0700 Subject: [PATCH] Factor out Secret Lab/Time Trial/NDM conds to function They are now factored out to an inline function named incompetitive(). This is so their usage can be changed without having to change each individual one in every place. This also clarifies the intent of using these conditionals (they are for when we're in a "competitive" mode). --- desktop_version/src/Game.cpp | 9 +++++++-- desktop_version/src/Input.cpp | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 3c83ef1e..19752004 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -6060,8 +6060,8 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ ) #if !defined(MAKEANDPLAY) option("unlock play modes"); #endif - option("invincibility", !ingame_titlemode || (!insecretlab && !intimetrial && !nodeathmode)); - option("slowdown", !ingame_titlemode || (!insecretlab && !intimetrial && !nodeathmode)); + option("invincibility", !ingame_titlemode || !incompetitive()); + option("slowdown", !ingame_titlemode || !incompetitive()); option("animated backgrounds"); option("screen effects"); option("text outline"); @@ -6805,3 +6805,8 @@ int Game::get_timestep(void) return 34; } } + +bool Game::incompetitive(void) +{ + return insecretlab || intimetrial || nodeathmode; +} diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index 28d9529d..9bfd4e71 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -636,7 +636,7 @@ static void menuactionpress(void) #endif if (game.currentmenuoption == accessibilityoffset + 0) { //invincibility - if (!game.ingame_titlemode || (!game.insecretlab && !game.intimetrial && !game.nodeathmode)) + if (!game.ingame_titlemode || !game.incompetitive()) { if (!map.invincibility) { @@ -658,7 +658,7 @@ static void menuactionpress(void) } else if (game.currentmenuoption == accessibilityoffset + 1) { //change game speed - if (!game.ingame_titlemode || (!game.insecretlab && !game.intimetrial && !game.nodeathmode)) + if (!game.ingame_titlemode || !game.incompetitive()) { game.createmenu(Menu::setslowdown); map.nexttowercolour();