From 85bd7d9a2dff8132198799c30a7eb818f40e4197 Mon Sep 17 00:00:00 2001 From: Misa Date: Wed, 8 Apr 2020 21:56:47 -0700 Subject: [PATCH] Remove map.customtrinkets This variable's sole purpose is to copy ed.numtrinkets, even though ed has always been a name that's been accessible globally. So let's not dupe cope. --- desktop_version/src/Game.cpp | 12 +++++++++--- desktop_version/src/Map.cpp | 2 -- desktop_version/src/Map.h | 1 - desktop_version/src/Render.cpp | 13 +++++++++---- desktop_version/src/Script.cpp | 4 +++- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 8f235eaa..e16c25da 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -1947,12 +1947,14 @@ void Game::updatestate() graphics.addline("You have found a shiny trinket!"); graphics.textboxcenterx(); +#if !defined(NO_CUSTOM_LEVELS) if(map.custommode) { - graphics.createtextbox(" " + help.number(trinkets()) + " out of " + help.number(map.customtrinkets)+ " ", 50, 65, 174, 174, 174); + graphics.createtextbox(" " + help.number(trinkets()) + " out of " + help.number(ed.numtrinkets)+ " ", 50, 65, 174, 174, 174); graphics.textboxcenterx(); } else +#endif { graphics.createtextbox(" " + help.number(trinkets()) + " out of Twenty ", 50, 65, 174, 174, 174); graphics.textboxcenterx(); @@ -1965,12 +1967,14 @@ void Game::updatestate() graphics.addline("You have found a shiny trinket!"); graphics.textboxcenterx(); +#if !defined(NO_CUSTOM_LEVELS) if(map.custommode) { - graphics.createtextbox(" " + help.number(trinkets()) + " out of " + help.number(map.customtrinkets)+ " ", 50, 135, 174, 174, 174); + graphics.createtextbox(" " + help.number(trinkets()) + " out of " + help.number(ed.numtrinkets)+ " ", 50, 135, 174, 174, 174); graphics.textboxcenterx(); } else +#endif { graphics.createtextbox(" " + help.number(trinkets()) + " out of Twenty ", 50, 135, 174, 174, 174); graphics.textboxcenterx(); @@ -2089,13 +2093,15 @@ void Game::updatestate() //Update level stats if(map.customcrewmates-crewmates()==0) { +#if !defined(NO_CUSTOM_LEVELS) //Finished level - if(map.customtrinkets-trinkets()==0) + if(ed.numtrinkets-trinkets()==0) { //and got all the trinkets! updatecustomlevelstats(customlevelfilename, 3); } else +#endif { updatecustomlevelstats(customlevelfilename, 1); } diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index 22fbf51c..3fe0aab8 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -42,7 +42,6 @@ mapclass::mapclass() custommode=false; custommodeforreal=false; - customtrinkets=0; customx=0; customy=0; customwidth=20; customheight=20; custommmxoff=0; custommmyoff=0; custommmxsize=0; custommmysize=0; @@ -1732,7 +1731,6 @@ void mapclass::loadlevel(int rx, int ry) } } - customtrinkets=ed.numtrinkets; customcrewmates=ed.numcrewmates; //do the appear/remove roomname here diff --git a/desktop_version/src/Map.h b/desktop_version/src/Map.h index d2993267..2d0bc658 100644 --- a/desktop_version/src/Map.h +++ b/desktop_version/src/Map.h @@ -134,7 +134,6 @@ public: bool custommodeforreal; int customx, customy; int customwidth, customheight; - int customtrinkets; int customcrewmates; int custommmxoff, custommmyoff, custommmxsize, custommmysize; int customzoom; diff --git a/desktop_version/src/Render.cpp b/desktop_version/src/Render.cpp index d409c913..056b9272 100644 --- a/desktop_version/src/Render.cpp +++ b/desktop_version/src/Render.cpp @@ -2245,11 +2245,13 @@ void maprender() graphics.Print(185-12, 220, "[STATS]", 196, 196, 255 - help.glow); graphics.Print(258, 220, "SAVE", 64, 64, 64); - if(map.custommode){ +#if !defined(NO_CUSTOM_LEVELS) + if(map.custommode) + { if (graphics.flipmode) { graphics.Print(0, 164, "[Trinkets found]", 196, 196, 255 - help.glow, true); - graphics.Print(0, 152, help.number(game.trinkets()) + " out of " + help.number(map.customtrinkets), 96,96,96, true); + graphics.Print(0, 152, help.number(game.trinkets()) + " out of " + help.number(ed.numtrinkets), 96,96,96, true); graphics.Print(0, 114, "[Number of Deaths]", 196, 196, 255 - help.glow, true); graphics.Print(0, 102,help.String(game.deathcounts), 96,96,96, true); @@ -2260,7 +2262,7 @@ void maprender() else { graphics.Print(0, 52, "[Trinkets found]", 196, 196, 255 - help.glow, true); - graphics.Print(0, 64, help.number(game.trinkets()) + " out of "+help.number(map.customtrinkets), 96,96,96, true); + graphics.Print(0, 64, help.number(game.trinkets()) + " out of "+help.number(ed.numtrinkets), 96,96,96, true); graphics.Print(0, 102, "[Number of Deaths]", 196, 196, 255 - help.glow, true); graphics.Print(0, 114,help.String(game.deathcounts), 96,96,96, true); @@ -2268,7 +2270,10 @@ void maprender() graphics.Print(0, 152, "[Time Taken]", 196, 196, 255 - help.glow, true); graphics.Print(0, 164, game.timestring(), 96, 96, 96, true); } - }else{ + } + else +#endif + { if (graphics.flipmode) { graphics.Print(0, 164, "[Trinkets found]", 196, 196, 255 - help.glow, true); diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index f3571e2b..d6384184 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -1887,11 +1887,13 @@ void scriptclass::run() graphics.textboxcenterx(); std::string usethisnum; +#if !defined(NO_CUSTOM_LEVELS) if (map.custommode) { - usethisnum = help.number(map.customtrinkets); + usethisnum = help.number(ed.numtrinkets); } else +#endif { usethisnum = "Twenty"; }