From fefeafe35f8dac30f4baab9e3bff8e2ffbd1afd0 Mon Sep 17 00:00:00 2001 From: zecke Date: Fri, 15 Oct 2004 01:48:45 +0000 Subject: Fix #1450 to clear the 'bonus' for removing every stone in the game --- (limited to 'noncore/games') diff --git a/noncore/games/zsame/StoneField.cpp b/noncore/games/zsame/StoneField.cpp index 49d8eca..56e9dc5 100644 --- a/noncore/games/zsame/StoneField.cpp +++ b/noncore/games/zsame/StoneField.cpp @@ -352,6 +352,10 @@ bool StoneField::gotBonus() const { return m_gotBonus; } +void StoneField::clearBonus() { + m_gotBonus = false; +} + int StoneField::getBoard() const { return board; diff --git a/noncore/games/zsame/StoneField.h b/noncore/games/zsame/StoneField.h index 80be73a..d32d78d 100644 --- a/noncore/games/zsame/StoneField.h +++ b/noncore/games/zsame/StoneField.h @@ -91,8 +91,9 @@ public: int undo(int count=1); - bool isGameover() const; + bool isGameover() const; bool gotBonus() const; + void clearBonus(); bool undoPossible() const; int getBoard() const; int getScore() const; diff --git a/noncore/games/zsame/StoneWidget.cpp b/noncore/games/zsame/StoneWidget.cpp index 646fc9c..5dd0252 100644 --- a/noncore/games/zsame/StoneWidget.cpp +++ b/noncore/games/zsame/StoneWidget.cpp @@ -185,6 +185,10 @@ bool StoneWidget::hasBonus() { return stonefield.gotBonus(); // don't ask me why the names differ... ;-| [hlm] } +void StoneWidget::clearBonus() { + stonefield.clearBonus(); +} + bool StoneWidget::isOriginalBoard() { return !modified; } diff --git a/noncore/games/zsame/StoneWidget.h b/noncore/games/zsame/StoneWidget.h index 9cd7e10..89a8afc 100644 --- a/noncore/games/zsame/StoneWidget.h +++ b/noncore/games/zsame/StoneWidget.h @@ -71,6 +71,7 @@ public: bool isGameover(); // if isGameover(): finished with bonus? bool hasBonus(); + void clearBonus(); // test for unchanged start position bool isOriginalBoard(); diff --git a/noncore/games/zsame/ZSameWidget.cpp b/noncore/games/zsame/ZSameWidget.cpp index 04ad825..dee4a1c 100644 --- a/noncore/games/zsame/ZSameWidget.cpp +++ b/noncore/games/zsame/ZSameWidget.cpp @@ -218,6 +218,7 @@ void ZSameWidget::gameover() { QMessageBox::information(this,i18n("Game won"), i18n("You even removed the last stone, great job! " "This gave you a score of %1 in total.").arg(stone->score())); + stone->clearBonus(); } else { QMessageBox::information(this,i18n("Game over"), i18n("There are no more removeable stones. " -- cgit v0.9.0.2