diff --git a/source/code/BlockGame.cpp b/source/code/BlockGame.cpp index 98659a6..690638d 100644 --- a/source/code/BlockGame.cpp +++ b/source/code/BlockGame.cpp @@ -1786,13 +1786,13 @@ void BlockGame::UpdateInternal(unsigned int newtick) { } void BlockGame::DoAction (const BlockGameAction& action) { - if (action.isUpdate) { + if (action.action == BlockGameAction::Action::UPDATE) { UpdateInternal(action.tick); } - if (action.setDraw) { + if (action.action == BlockGameAction::Action::SET_DRAW) { setDraw(); } - if (action.setPlayerWon) { + if (action.action == BlockGameAction::Action::SET_WON) { setPlayerWon(); } } diff --git a/source/code/BlockGame.hpp b/source/code/BlockGame.hpp index cb652bd..df9d4ed 100644 --- a/source/code/BlockGame.hpp +++ b/source/code/BlockGame.hpp @@ -79,10 +79,9 @@ struct GarbageStruct { }; struct BlockGameAction { + enum class Action {NONE, UPDATE, SET_DRAW, SET_WON}; + Action action = Action::NONE; unsigned int tick = 0; - bool isUpdate = false; - bool setDraw = false; - bool setPlayerWon = false; }; //////////////////////////////////////////////////////////////////////////////// diff --git a/source/code/main.cpp b/source/code/main.cpp index 7fac99e..f252ff3 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp @@ -1884,7 +1884,7 @@ int runGame(int gametype, int level) { bNearDeath = theGame.IsNearDeath() || theGame2.IsNearDeath(); //Updates the objects BlockGameAction a; - a.isUpdate = true; + a.action = BlockGameAction::Action::UPDATE; a.tick = SDL_GetTicks(); theGame.DoAction(a); theGame2.DoAction(a); @@ -1897,17 +1897,17 @@ int runGame(int gametype, int level) { if ((theGame.isGameOver()) && (theGame2.isGameOver())) { if (theGame.GetScore()+theGame.GetHandicap()>theGame2.GetScore()+theGame2.GetHandicap()) { BlockGameAction a; - a.setPlayerWon = true; + a.action = BlockGameAction::Action::SET_WON; theGame.DoAction(a); } else if (theGame.GetScore()+theGame.GetHandicap() gs;