Commit fcb0babd authored by Julian Helfferich's avatar Julian Helfferich 💬
Browse files

Do not return status in deleteSingleGames() method

The status was determined by whether single games were created before
the call to deleteSingleGames(). The better way to check this is to use
the new hasSingleGames() functionality as it is now done in KBlocksWin.
parent 288c346a
......@@ -39,7 +39,7 @@ public:
virtual void continueGame() = 0;
virtual bool hasSingleGames() = 0;
virtual bool deleteSingleGames() = 0;
virtual void deleteSingleGames() = 0;
signals:
void allGamesStopped();
......
......@@ -312,18 +312,12 @@ void KBlocksGameLogic::createSingleGames(int gameCount)
delete[] seedList;
}
bool KBlocksGameLogic::deleteSingleGames()
void KBlocksGameLogic::deleteSingleGames()
{
if (mGameCount == 0) {
return false;
}
for (int i = 0; i < mGameCount; i++) {
maGameList[i]->stopGame();
delete maGameList[i];
maGameList[i] = 0;
}
mGameCount = 0;
return true;
}
......@@ -59,7 +59,7 @@ public:
* Return whether single games have been created.
*/
bool hasSingleGames() override;
bool deleteSingleGames() override;
void deleteSingleGames() override;
public slots:
bool stopGame() override;
......
......@@ -38,7 +38,7 @@ public:
void continueGame() override {}
bool hasSingleGames() override { return true; }
bool deleteSingleGames() override { singleGamesDeleted = true; return true; }
void deleteSingleGames() override { singleGamesDeleted = true; }
public:
bool singleGamesDeleted;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment