summaryrefslogtreecommitdiff
authorzecke <zecke>2004-10-15 01:48:45 (UTC)
committer zecke <zecke>2004-10-15 01:48:45 (UTC)
commitfefeafe35f8dac30f4baab9e3bff8e2ffbd1afd0 (patch) (unidiff)
treea59a3bd9b5434657ee014dd6bbf7fbb50f5994d0
parent85ab1a8cc3935538cc1f33fef7c94ba31accb53e (diff)
downloadopie-fefeafe35f8dac30f4baab9e3bff8e2ffbd1afd0.zip
opie-fefeafe35f8dac30f4baab9e3bff8e2ffbd1afd0.tar.gz
opie-fefeafe35f8dac30f4baab9e3bff8e2ffbd1afd0.tar.bz2
Fix #1450 to clear the 'bonus' for removing every stone in the game
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/zsame/StoneField.cpp4
-rw-r--r--noncore/games/zsame/StoneField.h3
-rw-r--r--noncore/games/zsame/StoneWidget.cpp4
-rw-r--r--noncore/games/zsame/StoneWidget.h1
-rw-r--r--noncore/games/zsame/ZSameWidget.cpp1
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 {
349} 349}
350 350
351bool StoneField::gotBonus() const { 351bool StoneField::gotBonus() const {
352 return m_gotBonus; 352 return m_gotBonus;
353} 353}
354 354
355void StoneField::clearBonus() {
356 m_gotBonus = false;
357}
358
355int 359int
356StoneField::getBoard() const { 360StoneField::getBoard() const {
357 return board; 361 return board;
358} 362}
359 363
360int 364int
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:
88 void unmark(); 88 void unmark();
89 89
90 int remove(int x,int y,bool force=false); 90 int remove(int x,int y,bool force=false);
91 91
92 int undo(int count=1); 92 int undo(int count=1);
93 93
94 bool isGameover() const; 94 bool isGameover() const;
95 bool gotBonus() const; 95 bool gotBonus() const;
96 void clearBonus();
96 bool undoPossible() const; 97 bool undoPossible() const;
97 int getBoard() const; 98 int getBoard() const;
98 int getScore() const; 99 int getScore() const;
99 int getColors() const; 100 int getColors() const;
100 int getMarked() const; 101 int getMarked() const;
101 102
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() {
182} 182}
183 183
184bool StoneWidget::hasBonus() { 184bool StoneWidget::hasBonus() {
185 return stonefield.gotBonus(); // don't ask me why the names differ... ;-| [hlm] 185 return stonefield.gotBonus(); // don't ask me why the names differ... ;-| [hlm]
186} 186}
187 187
188void StoneWidget::clearBonus() {
189 stonefield.clearBonus();
190}
191
188bool StoneWidget::isOriginalBoard() { 192bool StoneWidget::isOriginalBoard() {
189 return !modified; 193 return !modified;
190} 194}
191 195
192void StoneWidget::readProperties(Config *) { 196void StoneWidget::readProperties(Config *) {
193/* Q_ASSERT(conf); 197/* 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:
68 int undo(int count=1); 68 int undo(int count=1);
69 69
70 // test for game end 70 // test for game end
71 bool isGameover(); 71 bool isGameover();
72 // if isGameover(): finished with bonus? 72 // if isGameover(): finished with bonus?
73 bool hasBonus(); 73 bool hasBonus();
74 void clearBonus();
74 // test for unchanged start position 75 // test for unchanged start position
75 bool isOriginalBoard(); 76 bool isOriginalBoard();
76 77
77 virtual void readProperties(Config *conf); 78 virtual void readProperties(Config *conf);
78 virtual void saveProperties(Config *conf); 79 virtual void saveProperties(Config *conf);
79 80
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 ) {
215void ZSameWidget::gameover() { 215void ZSameWidget::gameover() {
216// kdDebug() << "GameOver" << endl; 216// kdDebug() << "GameOver" << endl;
217 if (stone->hasBonus()) { 217 if (stone->hasBonus()) {
218 QMessageBox::information(this,i18n("Game won"), 218 QMessageBox::information(this,i18n("Game won"),
219 i18n("<qt>You even removed the last stone, great job! " 219 i18n("<qt>You even removed the last stone, great job! "
220 "This gave you a score of %1 in total.</qt>").arg(stone->score())); 220 "This gave you a score of %1 in total.</qt>").arg(stone->score()));
221 stone->clearBonus();
221 } else { 222 } else {
222 QMessageBox::information(this,i18n("Game over"), 223 QMessageBox::information(this,i18n("Game over"),
223 i18n("<qt>There are no more removeable stones. " 224 i18n("<qt>There are no more removeable stones. "
224 "You got a score of %1 in total.</qt>").arg(stone->score())); 225 "You got a score of %1 in total.</qt>").arg(stone->score()));
225 } 226 }
226 stone->unmark(); 227 stone->unmark();