From 1e3879b8feaf4364fd6277765c114694161830c9 Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 15 Apr 2020 12:16:53 -0700 Subject: [PATCH] De-duplicate "You have unlocked" menu input and options They all have the same input handling and menu options, so condense them into one block instead of duplicating the same block of code multiple times. --- desktop_version/src/Game.cpp | 24 +++++------------------- desktop_version/src/Input.cpp | 14 +++++--------- 2 files changed, 10 insertions(+), 28 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 21c5487e..54399926 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -6955,25 +6955,11 @@ void Game::createmenu( std::string t ) } } } - else if (t == "unlocktimetrial" || t == "unlocktimetrials") - { - option("continue"); - menuxoff = 20; - menuyoff = 70; - } - else if (t == "unlocknodeathmode") - { - option("continue"); - menuxoff = 20; - menuyoff = 70; - } - else if (t == "unlockintermission") - { - option("continue"); - menuxoff = 20; - menuyoff = 70; - } - else if (t == "unlockflipmode") + else if (t == "unlocktimetrial" + || t == "unlocktimetrials" + || t == "unlocknodeathmode" + || t == "unlockintermission" + || t == "unlockflipmode") { option("continue"); menuxoff = 20; diff --git a/desktop_version/src/Input.cpp b/desktop_version/src/Input.cpp index 3a8d5f91..47fab70d 100644 --- a/desktop_version/src/Input.cpp +++ b/desktop_version/src/Input.cpp @@ -1343,15 +1343,11 @@ void menuactionpress() game.createmenu("mainmenu"); map.nexttowercolour(); } - else if (game.currentmenuname == "unlocktimetrials" || game.currentmenuname == "unlocktimetrial") - { - //back - music.playef(11); - game.createmenu("play"); - map.nexttowercolour(); - } - else if (game.currentmenuname == "unlocknodeathmode" || game.currentmenuname == "unlockintermission" - || game.currentmenuname == "unlockflipmode") + else if (game.currentmenuname == "unlocktimetrials" + || game.currentmenuname == "unlocktimetrial" + || game.currentmenuname == "unlocknodeathmode" + || game.currentmenuname == "unlockintermission" + || game.currentmenuname == "unlockflipmode") { //back music.playef(11);