-rw-r--r-- | noncore/games/zsame/StoneField.cpp | 4 | ||||
-rw-r--r-- | noncore/games/zsame/StoneField.h | 3 | ||||
-rw-r--r-- | noncore/games/zsame/StoneWidget.cpp | 4 | ||||
-rw-r--r-- | noncore/games/zsame/StoneWidget.h | 1 | ||||
-rw-r--r-- | noncore/games/zsame/ZSameWidget.cpp | 1 |
5 files changed, 12 insertions, 1 deletions
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 @@ -349,12 +349,16 @@ StoneField::isGameover() const { } bool StoneField::gotBonus() const { return m_gotBonus; } +void StoneField::clearBonus() { + m_gotBonus = false; +} + int StoneField::getBoard() const { return board; } int 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 @@ -88,14 +88,15 @@ public: void unmark(); int remove(int x,int y,bool force=false); 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; int getColors() const; int getMarked() 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 @@ -182,12 +182,16 @@ bool StoneWidget::isGameover() { } 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; } void StoneWidget::readProperties(Config *) { /* Q_ASSERT(conf); 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 @@ -68,12 +68,13 @@ public: int undo(int count=1); // test for game end bool isGameover(); // if isGameover(): finished with bonus? bool hasBonus(); + void clearBonus(); // test for unchanged start position bool isOriginalBoard(); virtual void readProperties(Config *conf); virtual void saveProperties(Config *conf); 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 @@ -215,12 +215,13 @@ void ZSameWidget::setScore(int ) { void ZSameWidget::gameover() { // kdDebug() << "GameOver" << endl; if (stone->hasBonus()) { QMessageBox::information(this,i18n("Game won"), i18n("<qt>You even removed the last stone, great job! " "This gave you a score of %1 in total.</qt>").arg(stone->score())); + stone->clearBonus(); } else { QMessageBox::information(this,i18n("Game over"), i18n("<qt>There are no more removeable stones. " "You got a score of %1 in total.</qt>").arg(stone->score())); } stone->unmark(); |