diff --git a/source/code/BlockGame.cpp b/source/code/BlockGame.cpp index b723c77..af80ef7 100644 --- a/source/code/BlockGame.cpp +++ b/source/code/BlockGame.cpp @@ -1785,8 +1785,10 @@ void BlockGame::UpdateInternal(unsigned int newtick) { } } -void BlockGame::Update(unsigned int newtick) { - UpdateInternal(newtick); +void BlockGame::DoAction (const BlockGameAction& action) { + if (action.isUpdate) { + UpdateInternal(action.tick); + } } bool BlockGame::isSinglePuzzle() const { diff --git a/source/code/BlockGame.hpp b/source/code/BlockGame.hpp index b4778e4..733f9d2 100644 --- a/source/code/BlockGame.hpp +++ b/source/code/BlockGame.hpp @@ -78,6 +78,12 @@ struct GarbageStruct { } }; +struct BlockGameAction { + unsigned int tick = 0; + bool isUpdate = false; + +}; + //////////////////////////////////////////////////////////////////////////////// //The BloackGame class represents a board, score, time etc. for a single player/ //////////////////////////////////////////////////////////////////////////////// @@ -174,6 +180,8 @@ public: virtual void TimeTrialEndEvent() const {} virtual void EndlessHighscoreEvent() const {} + void DoAction (const BlockGameAction& action); + int GetScore() const; int GetHandicap() const; bool isGameOver() const; @@ -215,7 +223,6 @@ public: void SwitchAtCursor(); //Generates a new line and moves the field one block up (restart puzzle mode) void PushLine(); - void Update(unsigned int newtick); //Prints "winner" and ends game void setPlayerWon(); //Prints "draw" and ends the game diff --git a/source/code/main.cpp b/source/code/main.cpp index 868c7bc..bd33321 100644 --- a/source/code/main.cpp +++ b/source/code/main.cpp @@ -1883,8 +1883,11 @@ int runGame(int gametype, int level) { //set bNearDeath to false theGame*.Update() will change to true as needed bNearDeath = theGame.IsNearDeath() || theGame2.IsNearDeath(); //Updates the objects - theGame.Update(SDL_GetTicks()); - theGame2.Update(SDL_GetTicks()); + BlockGameAction a; + a.isUpdate = true; + a.tick = SDL_GetTicks(); + theGame.DoAction(a); + theGame2.DoAction(a); //see if anyone has won (two players only) #if NETWORK