diff --git a/source/code/BlockGame.cpp b/source/code/BlockGame.cpp index af80ef7..98659a6 100644 --- a/source/code/BlockGame.cpp +++ b/source/code/BlockGame.cpp @@ -1789,6 +1789,12 @@ void BlockGame::DoAction (const BlockGameAction& action) { if (action.isUpdate) { UpdateInternal(action.tick); } + if (action.setDraw) { + setDraw(); + } + if (action.setPlayerWon) { + setPlayerWon(); + } } bool BlockGame::isSinglePuzzle() const { diff --git a/source/code/BlockGame.hpp b/source/code/BlockGame.hpp index 733f9d2..cb652bd 100644 --- a/source/code/BlockGame.hpp +++ b/source/code/BlockGame.hpp @@ -81,7 +81,8 @@ struct GarbageStruct { struct BlockGameAction { unsigned int tick = 0; bool isUpdate = false; - + bool setDraw = false; + bool setPlayerWon = false; }; //////////////////////////////////////////////////////////////////////////////// @@ -223,10 +224,6 @@ public: void SwitchAtCursor(); //Generates a new line and moves the field one block up (restart puzzle mode) void PushLine(); - //Prints "winner" and ends game - void setPlayerWon(); - //Prints "draw" and ends the game - void setDraw(); private: void NewGame(unsigned int ticks); //Test if LineNr is an empty line, returns false otherwise. @@ -296,6 +293,10 @@ private: //Set the move speed of the AI based on the aiLevel parameter void setAIlevel(int aiLevel); void PushLineInternal(); + //Prints "winner" and ends game + void setPlayerWon(); + //Prints "draw" and ends the game + void setDraw(); //Updates evrything, if not called nothing happends void Update(); void UpdateInternal(unsigned int newtick); diff --git a/source/code/main.cpp b/source/code/main.cpp index bd33321..7fac99e 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp @@ -1896,24 +1896,32 @@ int runGame(int gametype, int level) { if (twoPlayers) { if ((theGame.isGameOver()) && (theGame2.isGameOver())) { if (theGame.GetScore()+theGame.GetHandicap()>theGame2.GetScore()+theGame2.GetHandicap()) { - theGame.setPlayerWon(); + BlockGameAction a; + a.setPlayerWon = true; + theGame.DoAction(a); } else if (theGame.GetScore()+theGame.GetHandicap() gs; theGame.PopSendGarbage(gs);