author | zecke <zecke> | 2004-10-15 01:48:45 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-10-15 01:48:45 (UTC) |
commit | fefeafe35f8dac30f4baab9e3bff8e2ffbd1afd0 (patch) (unidiff) | |
tree | a59a3bd9b5434657ee014dd6bbf7fbb50f5994d0 | |
parent | 85ab1a8cc3935538cc1f33fef7c94ba31accb53e (diff) | |
download | opie-fefeafe35f8dac30f4baab9e3bff8e2ffbd1afd0.zip opie-fefeafe35f8dac30f4baab9e3bff8e2ffbd1afd0.tar.gz opie-fefeafe35f8dac30f4baab9e3bff8e2ffbd1afd0.tar.bz2 |
Fix #1450 to clear the 'bonus' for removing every stone in the game
-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 | |||
@@ -307,84 +307,88 @@ StoneField::undo(int count) { | |||
307 | StoneFieldState *state=0; | 307 | StoneFieldState *state=0; |
308 | undolist->setAutoDelete(true); | 308 | undolist->setAutoDelete(true); |
309 | while (--count>0) { | 309 | while (--count>0) { |
310 | if (undolist->count()==1) break; | 310 | if (undolist->count()==1) break; |
311 | undolist->removeLast(); | 311 | undolist->removeLast(); |
312 | undocount++; | 312 | undocount++; |
313 | } | 313 | } |
314 | state=undolist->getLast(); | 314 | state=undolist->getLast(); |
315 | // Q_ASSERT(state); | 315 | // Q_ASSERT(state); |
316 | state->restore(*this); | 316 | state->restore(*this); |
317 | undolist->removeLast(); | 317 | undolist->removeLast(); |
318 | return undocount; | 318 | return undocount; |
319 | } | 319 | } |
320 | 320 | ||
321 | bool | 321 | bool |
322 | StoneField::isGameover() const { | 322 | StoneField::isGameover() const { |
323 | register int i=maxstone-1;; | 323 | register int i=maxstone-1;; |
324 | register unsigned char color; | 324 | register unsigned char color; |
325 | 325 | ||
326 | if (gameover>=0) return (bool)gameover; | 326 | if (gameover>=0) return (bool)gameover; |
327 | // kdDebug() << "-->gameover" << endl; | 327 | // kdDebug() << "-->gameover" << endl; |
328 | 328 | ||
329 | while (i>=0) { | 329 | while (i>=0) { |
330 | // kdDebug() << i << " " << field[i].color << endl; | 330 | // kdDebug() << i << " " << field[i].color << endl; |
331 | // ignore empty fields | 331 | // ignore empty fields |
332 | while ( i>=0 && field[i].color==0 ) i--; | 332 | while ( i>=0 && field[i].color==0 ) i--; |
333 | // Wenn Stein gefunden, | 333 | // Wenn Stein gefunden, |
334 | // dann die Nachbarn auf gleiche Farbe pruefen. | 334 | // dann die Nachbarn auf gleiche Farbe pruefen. |
335 | while ( i>=0 && (color=field[i].color) ) { | 335 | while ( i>=0 && (color=field[i].color) ) { |
336 | // check left | 336 | // check left |
337 | if ( (i%sizex)!=0 && field[i-1].color==color) | 337 | if ( (i%sizex)!=0 && field[i-1].color==color) |
338 | goto check_gameover; | 338 | goto check_gameover; |
339 | // check upward | 339 | // check upward |
340 | if ( i>=sizex && field[i-sizex].color==color) | 340 | if ( i>=sizex && field[i-sizex].color==color) |
341 | goto check_gameover; | 341 | goto check_gameover; |
342 | i--; | 342 | i--; |
343 | } | 343 | } |
344 | } | 344 | } |
345 | check_gameover: | 345 | check_gameover: |
346 | gameover=(i<0); | 346 | gameover=(i<0); |
347 | // kdDebug() << "<--gameover" << endl; | 347 | // kdDebug() << "<--gameover" << endl; |
348 | return (bool)gameover; | 348 | return (bool)gameover; |
349 | } | 349 | } |
350 | 350 | ||
351 | bool StoneField::gotBonus() const { | 351 | bool StoneField::gotBonus() const { |
352 | return m_gotBonus; | 352 | return m_gotBonus; |
353 | } | 353 | } |
354 | 354 | ||
355 | void StoneField::clearBonus() { | ||
356 | m_gotBonus = false; | ||
357 | } | ||
358 | |||
355 | int | 359 | int |
356 | StoneField::getBoard() const { | 360 | StoneField::getBoard() const { |
357 | return board; | 361 | return board; |
358 | } | 362 | } |
359 | 363 | ||
360 | int | 364 | int |
361 | StoneField::getScore() const { | 365 | StoneField::getScore() const { |
362 | return score; | 366 | return score; |
363 | } | 367 | } |
364 | 368 | ||
365 | int | 369 | int |
366 | StoneField::getColors() const { | 370 | StoneField::getColors() const { |
367 | return colors; | 371 | return colors; |
368 | } | 372 | } |
369 | 373 | ||
370 | int | 374 | int |
371 | StoneField::getMarked() const { | 375 | StoneField::getMarked() const { |
372 | return marked; | 376 | return marked; |
373 | } | 377 | } |
374 | 378 | ||
375 | int | 379 | int |
376 | StoneField::getFieldSize() const { | 380 | StoneField::getFieldSize() const { |
377 | return maxstone; | 381 | return maxstone; |
378 | } | 382 | } |
379 | 383 | ||
380 | struct Stone * | 384 | struct Stone * |
381 | StoneField::getField() const { | 385 | StoneField::getField() const { |
382 | return field; | 386 | return field; |
383 | } | 387 | } |
384 | 388 | ||
385 | 389 | ||
386 | 390 | ||
387 | 391 | ||
388 | 392 | ||
389 | 393 | ||
390 | 394 | ||
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 | |||
@@ -46,68 +46,69 @@ private: | |||
46 | public: | 46 | public: |
47 | StoneFieldState(const StoneField &stonefield); | 47 | StoneFieldState(const StoneField &stonefield); |
48 | ~StoneFieldState(); | 48 | ~StoneFieldState(); |
49 | void restore(StoneField &stonefield) const; | 49 | void restore(StoneField &stonefield) const; |
50 | }; | 50 | }; |
51 | 51 | ||
52 | 52 | ||
53 | class StoneField { | 53 | class StoneField { |
54 | friend class StoneFieldState; | 54 | friend class StoneFieldState; |
55 | friend class StoneWidget; | 55 | friend class StoneWidget; |
56 | private: | 56 | private: |
57 | 57 | ||
58 | int sizex; | 58 | int sizex; |
59 | int sizey; | 59 | int sizey; |
60 | int maxstone; | 60 | int maxstone; |
61 | 61 | ||
62 | struct Stone *field; | 62 | struct Stone *field; |
63 | 63 | ||
64 | int colors; | 64 | int colors; |
65 | unsigned int board; | 65 | unsigned int board; |
66 | unsigned int score; | 66 | unsigned int score; |
67 | mutable int gameover; | 67 | mutable int gameover; |
68 | bool m_gotBonus; | 68 | bool m_gotBonus; |
69 | int marked; | 69 | int marked; |
70 | 70 | ||
71 | KRandomSequence random; | 71 | KRandomSequence random; |
72 | QList<StoneFieldState> *undolist; | 72 | QList<StoneFieldState> *undolist; |
73 | public: | 73 | public: |
74 | StoneField(int width=15,int height=10, | 74 | StoneField(int width=15,int height=10, |
75 | int colors=3,unsigned int board=0, | 75 | int colors=3,unsigned int board=0, |
76 | bool undoenabled=true); | 76 | bool undoenabled=true); |
77 | ~StoneField(); | 77 | ~StoneField(); |
78 | 78 | ||
79 | int width() const; | 79 | int width() const; |
80 | int height() const; | 80 | int height() const; |
81 | 81 | ||
82 | void newGame(unsigned int board,int colors); | 82 | void newGame(unsigned int board,int colors); |
83 | 83 | ||
84 | void reset(); | 84 | void reset(); |
85 | 85 | ||
86 | 86 | ||
87 | int mark(int x,int y,bool force=false); | 87 | int mark(int x,int y,bool force=false); |
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 | ||
102 | protected: | 103 | protected: |
103 | int getFieldSize() const; | 104 | int getFieldSize() const; |
104 | struct Stone *getField() const; | 105 | struct Stone *getField() const; |
105 | 106 | ||
106 | int map(int x,int y); | 107 | int map(int x,int y); |
107 | void mark(int index,unsigned char color); | 108 | void mark(int index,unsigned char color); |
108 | }; | 109 | }; |
109 | 110 | ||
110 | #endif | 111 | #endif |
111 | 112 | ||
112 | 113 | ||
113 | 114 | ||
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 | |||
@@ -140,96 +140,100 @@ StoneWidget::newGame(unsigned int board,int colors) { | |||
140 | void | 140 | void |
141 | StoneWidget::reset() { | 141 | StoneWidget::reset() { |
142 | stonefield.reset(); | 142 | stonefield.reset(); |
143 | history.clear(); | 143 | history.clear(); |
144 | emit s_newgame(); | 144 | emit s_newgame(); |
145 | } | 145 | } |
146 | 146 | ||
147 | void | 147 | void |
148 | StoneWidget::unmark() { | 148 | StoneWidget::unmark() { |
149 | stonefield.unmark(); | 149 | stonefield.unmark(); |
150 | emit s_marked(0); | 150 | emit s_marked(0); |
151 | } | 151 | } |
152 | 152 | ||
153 | bool StoneWidget::undoPossible() const { | 153 | bool StoneWidget::undoPossible() const { |
154 | if (stonefield.isGameover()) return false; | 154 | if (stonefield.isGameover()) return false; |
155 | return stonefield.undoPossible(); | 155 | return stonefield.undoPossible(); |
156 | } | 156 | } |
157 | 157 | ||
158 | int | 158 | int |
159 | StoneWidget::undo(int count) { | 159 | StoneWidget::undo(int count) { |
160 | if (stonefield.isGameover()) return 0; | 160 | if (stonefield.isGameover()) return 0; |
161 | 161 | ||
162 | int ret_val=stonefield.undo(count); | 162 | int ret_val=stonefield.undo(count); |
163 | 163 | ||
164 | QPoint p=mapFromGlobal(cursor().pos()); | 164 | QPoint p=mapFromGlobal(cursor().pos()); |
165 | int x=p.x(); | 165 | int x=p.x(); |
166 | int y=p.y(); | 166 | int y=p.y(); |
167 | if (x<0||y<0||x>=field_width||y>=field_height) { | 167 | if (x<0||y<0||x>=field_width||y>=field_height) { |
168 | emit s_score(stonefield.getMarked()); | 168 | emit s_score(stonefield.getMarked()); |
169 | return ret_val; | 169 | return ret_val; |
170 | } | 170 | } |
171 | 171 | ||
172 | int marked=stonefield.mark(x/stone_width,y/stone_height); | 172 | int marked=stonefield.mark(x/stone_width,y/stone_height); |
173 | emit s_marked(marked); | 173 | emit s_marked(marked); |
174 | slice=0; | 174 | slice=0; |
175 | emit s_score(stonefield.getScore()); | 175 | emit s_score(stonefield.getScore()); |
176 | modified= (stonefield.getScore()>0); | 176 | modified= (stonefield.getScore()>0); |
177 | return ret_val; | 177 | return ret_val; |
178 | } | 178 | } |
179 | 179 | ||
180 | bool StoneWidget::isGameover() { | 180 | bool StoneWidget::isGameover() { |
181 | return stonefield.isGameover(); | 181 | return stonefield.isGameover(); |
182 | } | 182 | } |
183 | 183 | ||
184 | bool StoneWidget::hasBonus() { | 184 | bool 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 | ||
188 | void StoneWidget::clearBonus() { | ||
189 | stonefield.clearBonus(); | ||
190 | } | ||
191 | |||
188 | bool StoneWidget::isOriginalBoard() { | 192 | bool StoneWidget::isOriginalBoard() { |
189 | return !modified; | 193 | return !modified; |
190 | } | 194 | } |
191 | 195 | ||
192 | void StoneWidget::readProperties(Config *) { | 196 | void StoneWidget::readProperties(Config *) { |
193 | /* Q_ASSERT(conf); | 197 | /* Q_ASSERT(conf); |
194 | 198 | ||
195 | history.clear(); | 199 | history.clear(); |
196 | 200 | ||
197 | if (!conf->hasKey("Board")|| | 201 | if (!conf->hasKey("Board")|| |
198 | !conf->hasKey("Colors")|| | 202 | !conf->hasKey("Colors")|| |
199 | !conf->hasKey("Stones")) { | 203 | !conf->hasKey("Stones")) { |
200 | return; | 204 | return; |
201 | } | 205 | } |
202 | newGame(conf->readNumEntry("Board"),conf->readNumEntry("Colors")); | 206 | newGame(conf->readNumEntry("Board"),conf->readNumEntry("Colors")); |
203 | 207 | ||
204 | QStrList list; | 208 | QStrList list; |
205 | conf->readListEntry("Stones",list); | 209 | conf->readListEntry("Stones",list); |
206 | 210 | ||
207 | for (const char *item=list.first();item;item=list.next()) { | 211 | for (const char *item=list.first();item;item=list.next()) { |
208 | int x=-1,y=-1; | 212 | int x=-1,y=-1; |
209 | if (sscanf(item,"%02X%02X",&x,&y)!=2) break; | 213 | if (sscanf(item,"%02X%02X",&x,&y)!=2) break; |
210 | history.append(new QPoint(x,y)); | 214 | history.append(new QPoint(x,y)); |
211 | stonefield.remove(x,y); | 215 | stonefield.remove(x,y); |
212 | } | 216 | } |
213 | */ | 217 | */ |
214 | } | 218 | } |
215 | 219 | ||
216 | 220 | ||
217 | void | 221 | void |
218 | StoneWidget::saveProperties(Config *) { | 222 | StoneWidget::saveProperties(Config *) { |
219 | /* | 223 | /* |
220 | Q_ASSERT(conf); | 224 | Q_ASSERT(conf); |
221 | 225 | ||
222 | QStrList list(true); | 226 | QStrList list(true); |
223 | QString tmp; | 227 | QString tmp; |
224 | 228 | ||
225 | for (QPoint *item=history.first();item;item=history.next()) { | 229 | for (QPoint *item=history.first();item;item=history.next()) { |
226 | tmp.sprintf("%02X%02X",item->x(),item->y()); | 230 | tmp.sprintf("%02X%02X",item->x(),item->y()); |
227 | list.append(tmp.ascii()); | 231 | list.append(tmp.ascii()); |
228 | } | 232 | } |
229 | 233 | ||
230 | conf->writeEntry("Stones",list); | 234 | conf->writeEntry("Stones",list); |
231 | conf->writeEntry("Board",stonefield.getBoard()); | 235 | conf->writeEntry("Board",stonefield.getBoard()); |
232 | conf->writeEntry("Colors",stonefield.getColors()); | 236 | conf->writeEntry("Colors",stonefield.getColors()); |
233 | */ | 237 | */ |
234 | } | 238 | } |
235 | 239 | ||
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 | |||
@@ -26,90 +26,91 @@ | |||
26 | #include <qwidget.h> | 26 | #include <qwidget.h> |
27 | 27 | ||
28 | #include <qpe/config.h> | 28 | #include <qpe/config.h> |
29 | 29 | ||
30 | #include "StoneField.h" | 30 | #include "StoneField.h" |
31 | 31 | ||
32 | struct StoneSlice; | 32 | struct StoneSlice; |
33 | 33 | ||
34 | class StoneWidget : public QWidget { | 34 | class StoneWidget : public QWidget { |
35 | Q_OBJECT | 35 | Q_OBJECT |
36 | 36 | ||
37 | int modified; | 37 | int modified; |
38 | // int marked; // # of marked stones | 38 | // int marked; // # of marked stones |
39 | 39 | ||
40 | int stones_x, stones_y; | 40 | int stones_x, stones_y; |
41 | int sizex, sizey; | 41 | int sizex, sizey; |
42 | int field_width, field_height; | 42 | int field_width, field_height; |
43 | 43 | ||
44 | QList<QPoint> history; | 44 | QList<QPoint> history; |
45 | StoneField stonefield; | 45 | StoneField stonefield; |
46 | 46 | ||
47 | // picture number of stonemovie | 47 | // picture number of stonemovie |
48 | int slice; | 48 | int slice; |
49 | 49 | ||
50 | StoneSlice **map; | 50 | StoneSlice **map; |
51 | 51 | ||
52 | public: | 52 | public: |
53 | StoneWidget( QWidget *parent=0, int x=10,int y=10); | 53 | StoneWidget( QWidget *parent=0, int x=10,int y=10); |
54 | ~StoneWidget(); | 54 | ~StoneWidget(); |
55 | 55 | ||
56 | unsigned int board(); | 56 | unsigned int board(); |
57 | int score(); | 57 | int score(); |
58 | int marked(); | 58 | int marked(); |
59 | QSize size(); | 59 | QSize size(); |
60 | int colors(); | 60 | int colors(); |
61 | virtual QSize sizeHint() const; | 61 | virtual QSize sizeHint() const; |
62 | 62 | ||
63 | bool undoPossible() const; | 63 | bool undoPossible() const; |
64 | 64 | ||
65 | void newGame(unsigned int board, int colors); | 65 | void newGame(unsigned int board, int colors); |
66 | void reset(); | 66 | void reset(); |
67 | void unmark(); | 67 | void unmark(); |
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 | ||
80 | protected: | 81 | protected: |
81 | 82 | ||
82 | void timerEvent( QTimerEvent *e ); | 83 | void timerEvent( QTimerEvent *e ); |
83 | void paintEvent( QPaintEvent *e ); | 84 | void paintEvent( QPaintEvent *e ); |
84 | void mousePressEvent ( QMouseEvent *e); | 85 | void mousePressEvent ( QMouseEvent *e); |
85 | void myMoveEvent ( QMouseEvent *e); | 86 | void myMoveEvent ( QMouseEvent *e); |
86 | 87 | ||
87 | // properties of the stone picture | 88 | // properties of the stone picture |
88 | int stone_width,stone_height; // size of one stone | 89 | int stone_width,stone_height; // size of one stone |
89 | int maxcolors; // number of different stones (Y direction) | 90 | int maxcolors; // number of different stones (Y direction) |
90 | int maxslices; // number of pictures per movie (X direction) | 91 | int maxslices; // number of pictures per movie (X direction) |
91 | 92 | ||
92 | signals: | 93 | signals: |
93 | // A new game begins | 94 | // A new game begins |
94 | void s_newgame(); | 95 | void s_newgame(); |
95 | 96 | ||
96 | void s_colors(int colors); | 97 | void s_colors(int colors); |
97 | void s_board(int board); | 98 | void s_board(int board); |
98 | void s_score(int score); | 99 | void s_score(int score); |
99 | void s_marked(int m); | 100 | void s_marked(int m); |
100 | 101 | ||
101 | void s_gameover(); | 102 | void s_gameover(); |
102 | 103 | ||
103 | // The stone (x,y) was clicked(removed), | 104 | // The stone (x,y) was clicked(removed), |
104 | // all neighbor stones disappear without further signals | 105 | // all neighbor stones disappear without further signals |
105 | void s_remove(int x,int y); | 106 | void s_remove(int x,int y); |
106 | 107 | ||
107 | void s_sizechanged(); | 108 | void s_sizechanged(); |
108 | }; | 109 | }; |
109 | 110 | ||
110 | #endif | 111 | #endif |
111 | 112 | ||
112 | 113 | ||
113 | 114 | ||
114 | 115 | ||
115 | 116 | ||
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 | |||
@@ -173,72 +173,73 @@ void ZSameWidget::m_showhs() { | |||
173 | stone->unmark(); | 173 | stone->unmark(); |
174 | KScoreDialog d(KScoreDialog::Name | KScoreDialog::Score, this); | 174 | KScoreDialog d(KScoreDialog::Name | KScoreDialog::Score, this); |
175 | d.addField(Board, i18n("Board"), "Board"); | 175 | d.addField(Board, i18n("Board"), "Board"); |
176 | d.exec(); | 176 | d.exec(); |
177 | */ | 177 | */ |
178 | } | 178 | } |
179 | 179 | ||
180 | void ZSameWidget::m_quit() { | 180 | void ZSameWidget::m_quit() { |
181 | // Q_ASSERT(stone); | 181 | // Q_ASSERT(stone); |
182 | stone->unmark(); | 182 | stone->unmark(); |
183 | qApp->quit(); | 183 | qApp->quit(); |
184 | // delete this; | 184 | // delete this; |
185 | } | 185 | } |
186 | 186 | ||
187 | void ZSameWidget::m_tglboard() { | 187 | void ZSameWidget::m_tglboard() { |
188 | //kdDebug() << "toggled" << endl; | 188 | //kdDebug() << "toggled" << endl; |
189 | } | 189 | } |
190 | 190 | ||
191 | 191 | ||
192 | void ZSameWidget::setColors(int ) { | 192 | void ZSameWidget::setColors(int ) { |
193 | //status->changeItem(i18n("%1 Colors").arg(colors),1); | 193 | //status->changeItem(i18n("%1 Colors").arg(colors),1); |
194 | } | 194 | } |
195 | 195 | ||
196 | void ZSameWidget::setBoard(int ) { | 196 | void ZSameWidget::setBoard(int ) { |
197 | //status->changeItem(i18n("Board: %1").arg(board, 6), 2); | 197 | //status->changeItem(i18n("Board: %1").arg(board, 6), 2); |
198 | } | 198 | } |
199 | 199 | ||
200 | void ZSameWidget::setMarked(int ) { | 200 | void ZSameWidget::setMarked(int ) { |
201 | // status->changeItem(i18n("Marked: %1").arg(m, 6),3); | 201 | // status->changeItem(i18n("Marked: %1").arg(m, 6),3); |
202 | } | 202 | } |
203 | 203 | ||
204 | void ZSameWidget::stonesRemoved(int,int) { | 204 | void ZSameWidget::stonesRemoved(int,int) { |
205 | //KNotifyClient::event("stones removed", | 205 | //KNotifyClient::event("stones removed", |
206 | // i18n("%1 stones removed.").arg(stone->marked())); | 206 | // i18n("%1 stones removed.").arg(stone->marked())); |
207 | } | 207 | } |
208 | 208 | ||
209 | void ZSameWidget::setScore(int ) { | 209 | void ZSameWidget::setScore(int ) { |
210 | // status->changeItem(i18n("Score: %1").arg(score, 6),4); | 210 | // status->changeItem(i18n("Score: %1").arg(score, 6),4); |
211 | // undo->setEnabled(stone->undoPossible()); | 211 | // undo->setEnabled(stone->undoPossible()); |
212 | // restart->setEnabled(!stone->isOriginalBoard()); | 212 | // restart->setEnabled(!stone->isOriginalBoard()); |
213 | } | 213 | } |
214 | 214 | ||
215 | void ZSameWidget::gameover() { | 215 | void 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(); |
227 | } | 228 | } |
228 | 229 | ||
229 | void ZSameWidget::desktop_widget(int *f)const{ | 230 | void ZSameWidget::desktop_widget(int *f)const{ |
230 | 231 | ||
231 | QWidget* wid = QApplication::desktop(); | 232 | QWidget* wid = QApplication::desktop(); |
232 | /* width > height landscape mode */ | 233 | /* width > height landscape mode */ |
233 | if ( wid->width() > wid->height() ) { | 234 | if ( wid->width() > wid->height() ) { |
234 | f[0]=15; | 235 | f[0]=15; |
235 | f[1]=9; | 236 | f[1]=9; |
236 | } | 237 | } |
237 | /* normal */ | 238 | /* normal */ |
238 | else{ | 239 | else{ |
239 | f[0]=12; | 240 | f[0]=12; |
240 | f[1]=13; | 241 | f[1]=13; |
241 | } | 242 | } |
242 | } | 243 | } |
243 | 244 | ||
244 | 245 | ||