summaryrefslogtreecommitdiff
path: root/noncore/games
Unidiff
Diffstat (limited to 'noncore/games') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/backgammon/backgammon.cpp16
-rw-r--r--noncore/games/backgammon/moveengine.cpp2
-rw-r--r--noncore/games/bounce/bounce.pro5
-rw-r--r--noncore/games/bounce/game.cpp15
-rw-r--r--noncore/games/go/go.pro15
-rw-r--r--noncore/games/go/gowidget.cpp9
-rw-r--r--noncore/games/kpacman/kpacman.pro4
-rw-r--r--noncore/games/kpacman/kpacmanwidget.cpp5
-rw-r--r--noncore/games/kpacman/status.cpp5
-rw-r--r--noncore/games/mindbreaker/mindbreaker.cpp2
-rw-r--r--noncore/games/oyatzee/oyatzee.cpp50
-rw-r--r--noncore/games/oyatzee/oyatzee.pro2
-rw-r--r--noncore/games/wordgame/wordgame.cpp2
13 files changed, 75 insertions, 57 deletions
diff --git a/noncore/games/backgammon/backgammon.cpp b/noncore/games/backgammon/backgammon.cpp
index 51020a0..bdb1c78 100644
--- a/noncore/games/backgammon/backgammon.cpp
+++ b/noncore/games/backgammon/backgammon.cpp
@@ -1,105 +1,109 @@
1#include "backgammon.h" 1#include "backgammon.h"
2
3#include "aidialog.h" 2#include "aidialog.h"
4#include "filedialog.h" 3#include "filedialog.h"
5#include "playerdialog.h" 4#include "playerdialog.h"
6#include "rulesdialog.h" 5#include "rulesdialog.h"
7#include "themedialog.h" 6#include "themedialog.h"
8 7
8/* OPIE */
9#include <opie2/odebug.h>
10#include <qpe/qpeapplication.h>
11#include <qpe/config.h>
12#include <qpe/resource.h>
13using namespace Opie::Core;
14
15/* QT */
9#include <qfile.h> 16#include <qfile.h>
10#include <qlayout.h> 17#include <qlayout.h>
11#include <qmessagebox.h> 18#include <qmessagebox.h>
12#include <qtimer.h> 19#include <qtimer.h>
13#include <qpe/qpeapplication.h>
14#include <qpe/config.h>
15#include <qmenubar.h> 20#include <qmenubar.h>
16#include <qpe/resource.h>
17 21
18#include <stdlib.h> 22#include <stdlib.h>
19 23
20 24
21BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl) 25BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
22 : QMainWindow(parent, name, fl) 26 : QMainWindow(parent, name, fl)
23{ 27{
24 if (!name) setName("BackGammon"); 28 if (!name) setName("BackGammon");
25 setCaption(tr( "Backgammon") ); 29 setCaption(tr( "Backgammon") );
26 setIcon( Resource::loadPixmap( "backgammon" ) ); 30 setIcon( Resource::loadPixmap( "backgammon" ) );
27 //general counter varaible 31 //general counter varaible
28 int a=0; 32 int a=0;
29 //the game engine 33 //the game engine
30 move=new MoveEngine(); 34 move=new MoveEngine();
31 35
32 //load the default theme 36 //load the default theme
33 Config conf("backgammon"); 37 Config conf("backgammon");
34 if(!conf.isValid()) 38 if(!conf.isValid())
35 { 39 {
36 qDebug("config file does not exist"); 40 odebug << "config file does not exist" << oendl;
37 conf.setGroup("general"); 41 conf.setGroup("general");
38 conf.writeEntry("theme","default"); 42 conf.writeEntry("theme","default");
39 conf.setGroup("rules"); 43 conf.setGroup("rules");
40 conf.writeEntry("move_with_pieces_out",false); 44 conf.writeEntry("move_with_pieces_out",false);
41 conf.writeEntry("nice_dice",false); 45 conf.writeEntry("nice_dice",false);
42 conf.setGroup("display"); 46 conf.setGroup("display");
43 conf.writeEntry("small",false); 47 conf.writeEntry("small",false);
44 conf.writeEntry("warning",true); 48 conf.writeEntry("warning",true);
45 conf.setGroup("ai"); 49 conf.setGroup("ai");
46 conf.writeEntry("rescue",6); 50 conf.writeEntry("rescue",6);
47 conf.writeEntry("eliminate",4); 51 conf.writeEntry("eliminate",4);
48 conf.writeEntry("expose",1); 52 conf.writeEntry("expose",1);
49 conf.writeEntry("protect",5); 53 conf.writeEntry("protect",5);
50 conf.writeEntry("safe",3); 54 conf.writeEntry("safe",3);
51 conf.writeEntry("empty",2); 55 conf.writeEntry("empty",2);
52 56
53 } 57 }
54 conf.setGroup("general"); 58 conf.setGroup("general");
55 theme_name=conf.readEntry("theme","default"); 59 theme_name=conf.readEntry("theme","default");
56 QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme"; 60 QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme";
57 61
58 //the rules 62 //the rules
59 conf.setGroup("rules"); 63 conf.setGroup("rules");
60 rules.move_with_pieces_out=conf.readBoolEntry("move_with_pieces_out",false); 64 rules.move_with_pieces_out=conf.readBoolEntry("move_with_pieces_out",false);
61 rules.generous_dice=conf.readBoolEntry("nice_dice",false); 65 rules.generous_dice=conf.readBoolEntry("nice_dice",false);
62 66
63 move->setRules(rules); 67 move->setRules(rules);
64 68
65 //get the AI settings 69 //get the AI settings
66 AISettings ai; 70 AISettings ai;
67 conf.setGroup("ai"); 71 conf.setGroup("ai");
68 ai.rescue=conf.readNumEntry("rescue",6); 72 ai.rescue=conf.readNumEntry("rescue",6);
69 ai.eliminate=conf.readNumEntry("eliminate",4); 73 ai.eliminate=conf.readNumEntry("eliminate",4);
70 ai.expose=conf.readNumEntry("expose",1); 74 ai.expose=conf.readNumEntry("expose",1);
71 ai.protect=conf.readNumEntry("protect",5); 75 ai.protect=conf.readNumEntry("protect",5);
72 ai.safe=conf.readNumEntry("safe",3); 76 ai.safe=conf.readNumEntry("safe",3);
73 ai.empty=conf.readNumEntry("empty",2); 77 ai.empty=conf.readNumEntry("empty",2);
74 move->setAISettings(ai); 78 move->setAISettings(ai);
75 79
76 80
77 //get the theme component names 81 //get the theme component names
78 Config theme(theme_file,Config::File); 82 Config theme(theme_file,Config::File);
79 if(!theme.isValid()) 83 if(!theme.isValid())
80 { 84 {
81 qDebug("theme file does not exist"); 85 odebug << "theme file does not exist" << oendl;
82 theme.setGroup("theme"); 86 theme.setGroup("theme");
83 theme.writeEntry("board","casino_board_1"); 87 theme.writeEntry("board","casino_board_1");
84 theme.writeEntry("pieces1","casino_pieces_blue"); 88 theme.writeEntry("pieces1","casino_pieces_blue");
85 theme.writeEntry("pieces2","casino_pieces_white"); 89 theme.writeEntry("pieces2","casino_pieces_white");
86 theme.writeEntry("dice1","casino_dice"); 90 theme.writeEntry("dice1","casino_dice");
87 theme.writeEntry("dice2","casino_dice"); 91 theme.writeEntry("dice2","casino_dice");
88 theme.writeEntry("table","casino_table_green"); 92 theme.writeEntry("table","casino_table_green");
89 theme.writeEntry("odds","casino_odds"); 93 theme.writeEntry("odds","casino_odds");
90 } 94 }
91 theme.setGroup("theme"); 95 theme.setGroup("theme");
92 board_name=theme.readEntry("board","casino_board_1"); 96 board_name=theme.readEntry("board","casino_board_1");
93 piecesA_name=theme.readEntry("pieces1","casino_pieces_blue"); 97 piecesA_name=theme.readEntry("pieces1","casino_pieces_blue");
94 piecesB_name=theme.readEntry("pieces2","casino_pieces_white"); 98 piecesB_name=theme.readEntry("pieces2","casino_pieces_white");
95 diceA_name=theme.readEntry("dice1","casino_dice"); 99 diceA_name=theme.readEntry("dice1","casino_dice");
96 diceB_name=theme.readEntry("dice2","casino_dice"); 100 diceB_name=theme.readEntry("dice2","casino_dice");
97 table_name=theme.readEntry("table","casino_table_green"); 101 table_name=theme.readEntry("table","casino_table_green");
98 odds_name=theme.readEntry("odds","casino_odds"); 102 odds_name=theme.readEntry("odds","casino_odds");
99 103
100 104
101 //the menu 105 //the menu
102 QMenuBar* menuBar = new QMenuBar(this); 106 QMenuBar* menuBar = new QMenuBar(this);
103 107
104 QPopupMenu* gamemenu= new QPopupMenu(this); 108 QPopupMenu* gamemenu= new QPopupMenu(this);
105 gamemenu->insertItem(tr( "New" ),this,SLOT(newgame())); 109 gamemenu->insertItem(tr( "New" ),this,SLOT(newgame()));
diff --git a/noncore/games/backgammon/moveengine.cpp b/noncore/games/backgammon/moveengine.cpp
index 7de7147..a4145cc 100644
--- a/noncore/games/backgammon/moveengine.cpp
+++ b/noncore/games/backgammon/moveengine.cpp
@@ -436,49 +436,49 @@ int MoveEngine::getPossibleMoves()
436 else 436 else
437 moves[field].weight[b]=0; //default. 437 moves[field].weight[b]=0; //default.
438 } 438 }
439 439
440 440
441 441
442 else 442 else
443 moves[field].weight[b]=0; //dice already used or field not used by player 443 moves[field].weight[b]=0; //dice already used or field not used by player
444 } 444 }
445 445
446 446
447 447
448 } 448 }
449 449
450 int total=0; 450 int total=0;
451 for(int field=0;field<26;field++) 451 for(int field=0;field<26;field++)
452 { 452 {
453 total+=moves[field].weight[0]+moves[field].weight[1]+moves[field].weight[2]+moves[field].weight[3]; 453 total+=moves[field].weight[0]+moves[field].weight[1]+moves[field].weight[2]+moves[field].weight[3];
454 } 454 }
455 return total; 455 return total;
456} 456}
457 457
458void MoveEngine::move(const int& from, int to, const int& dice) 458void MoveEngine::move(const int& from, int to, const int& dice)
459{ 459{
460 //qDebug("%d moves from %d to %d (%d) with dice %d",player,from,to,to-from,dice); 460 //odebug << "" << player << " moves from " << from << " to " << to << " (" << to-from << ") with dice " << dice << "" << oendl;
461 461
462 if(player==1 && to==25) 462 if(player==1 && to==25)
463 to=26; 463 to=26;
464 if(player==2 && to==0) 464 if(player==2 && to==0)
465 to=27; 465 to=27;
466 466
467 //if space is occupied by enemy move pieces to startzone 467 //if space is occupied by enemy move pieces to startzone
468 if(fieldColor(to)==otherplayer) 468 if(fieldColor(to)==otherplayer)
469 { 469 {
470 population[to].total=0; 470 population[to].total=0;
471 if(otherplayer==1) 471 if(otherplayer==1)
472 population[0].total++; 472 population[0].total++;
473 else 473 else
474 population[25].total--; 474 population[25].total--;
475 } 475 }
476 476
477 if(player==1) 477 if(player==1)
478 { 478 {
479 population[from].total--; 479 population[from].total--;
480 population[to].total++; 480 population[to].total++;
481 } 481 }
482 else //player=2 482 else //player=2
483 { 483 {
484 population[from].total++; 484 population[from].total++;
diff --git a/noncore/games/bounce/bounce.pro b/noncore/games/bounce/bounce.pro
index ba745c8..56a325c 100644
--- a/noncore/games/bounce/bounce.pro
+++ b/noncore/games/bounce/bounce.pro
@@ -1,10 +1,9 @@
1 #CONFIG = qt warn_on 1 CONFIG = qt warn_on quick-app
2 CONFIG = qt warn_on quick-app
3 HEADERS = game.h kbounce.h 2 HEADERS = game.h kbounce.h
4 SOURCES = game.cpp kbounce.cpp main.cpp 3 SOURCES = game.cpp kbounce.cpp main.cpp
5 INCLUDEPATH+= $(OPIEDIR)/include 4 INCLUDEPATH+= $(OPIEDIR)/include
6 DEPENDPATH+= $(OPIEDIR)/include 5 DEPENDPATH+= $(OPIEDIR)/include
7LIBS += -lqpe -lopiecore2 6LIBS += -lqpe -lopiecore2
8 TARGET = bounce 7 TARGET = bounce
9 8
10include ( $(OPIEDIR)/include.pro ) 9include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/games/bounce/game.cpp b/noncore/games/bounce/game.cpp
index 1f1f8cd..bbd3d0b 100644
--- a/noncore/games/bounce/game.cpp
+++ b/noncore/games/bounce/game.cpp
@@ -1,48 +1,55 @@
1/* 1/*
2 * Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de> 2 * Copyright (C) 2000 Stefan Schimanski <1Stein@gmx.de>
3 * 3 *
4 * This program is free software; you can redistribute it and/or 4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public 5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either 6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version. 7 * version 2 of the License, or (at your option) any later version.
8 * 8 *
9 * This program is distributed in the hope that it will be useful, 9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details. 12 * Library General Public License for more details.
13 * 13 *
14 * You should have received a copy of the GNU Library General Public 14 * You should have received a copy of the GNU Library General Public
15 * License along with this program; if not, write to the Free 15 * License along with this program; if not, write to the Free
16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 16 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */ 17 */
18 18
19 19
20#include <stdlib.h> 20#include "game.h"
21#include <qtimer.h> 21
22/* OPIE */
23#include <opie2/odebug.h>
22#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
25using namespace Opie::Core;
23 26
24#include "game.h" 27/* QT */
28#include <qtimer.h>
29
30/* STD */
31#include <stdlib.h>
25 32
26#define TILE_SIZE 9 33#define TILE_SIZE 9
27 34
28#define TILE_FIRST ((FIELD_WIDTH-2)*(FIELD_HEIGHT-2)) 35#define TILE_FIRST ((FIELD_WIDTH-2)*(FIELD_HEIGHT-2))
29#define TILE_FREE (TILE_FIRST + 0) 36#define TILE_FREE (TILE_FIRST + 0)
30#define TILE_BORDER (TILE_FIRST + 1) 37#define TILE_BORDER (TILE_FIRST + 1)
31#define TILE_WALLEND (TILE_FIRST + 2) 38#define TILE_WALLEND (TILE_FIRST + 2)
32#define TILE_WALLUP (TILE_FIRST + 3) 39#define TILE_WALLUP (TILE_FIRST + 3)
33#define TILE_WALLDOWN (TILE_FIRST + 4) 40#define TILE_WALLDOWN (TILE_FIRST + 4)
34#define TILE_WALLLEFT (TILE_FIRST + 5) 41#define TILE_WALLLEFT (TILE_FIRST + 5)
35#define TILE_WALLRIGHT (TILE_FIRST + 6) 42#define TILE_WALLRIGHT (TILE_FIRST + 6)
36 43
37#define GAME_DELAY 15 44#define GAME_DELAY 15
38#define BALL_ANIM_DELAY 60 45#define BALL_ANIM_DELAY 60
39#define WALL_DELAY 100 46#define WALL_DELAY 100
40 47
41#define MS2TICKS( ms ) ((ms)/GAME_DELAY) 48#define MS2TICKS( ms ) ((ms)/GAME_DELAY)
42 49
43Arrow::Arrow(QCanvasPixmapArray* array, QCanvas* canvas) 50Arrow::Arrow(QCanvasPixmapArray* array, QCanvas* canvas)
44 : QCanvasSprite( array, canvas ) 51 : QCanvasSprite( array, canvas )
45{ 52{
46 m_vertical = true; 53 m_vertical = true;
47 move(3,3); 54 move(3,3);
48} 55}
@@ -346,49 +353,49 @@ JezzGame::JezzGame( int ballNum, QWidget *parent, const char *name )
346 arrow->show(); 353 arrow->show();
347 354
348 // create text label 355 // create text label
349 m_text = new QCanvasText( m_field ); 356 m_text = new QCanvasText( m_field );
350 357
351 // create game clock 358 // create game clock
352 m_clock = new QTimer( this ); 359 m_clock = new QTimer( this );
353 connect( m_clock, SIGNAL(timeout()), this, SLOT(tick()) ); 360 connect( m_clock, SIGNAL(timeout()), this, SLOT(tick()) );
354 m_clock->start( GAME_DELAY ); 361 m_clock->start( GAME_DELAY );
355 362
356 // setup geometry 363 // setup geometry
357 setFixedSize( m_view->size() ); 364 setFixedSize( m_view->size() );
358} 365}
359 366
360JezzGame::~JezzGame() 367JezzGame::~JezzGame()
361{ 368{
362 m_balls.clear(); 369 m_balls.clear();
363 delete m_view; 370 delete m_view;
364 delete m_field; 371 delete m_field;
365 delete m_ballPixmaps; 372 delete m_ballPixmaps;
366} 373}
367 374
368void JezzGame::display( QString text, int size ) 375void JezzGame::display( QString text, int size )
369{ 376{
370 qDebug("This function \"display\" shouldn't be called!!!"); 377 odebug << "This function \"display\" shouldn't be called!!!" << oendl;
371 if ( !text.isEmpty() ) 378 if ( !text.isEmpty() )
372 { 379 {
373 QFont font( "Helvetica", size, QFont::Bold ); 380 QFont font( "Helvetica", size, QFont::Bold );
374 font.setStyleHint( QFont::Helvetica ); 381 font.setStyleHint( QFont::Helvetica );
375 m_text->setFont( font ); 382 m_text->setFont( font );
376 m_text->setText( text ); 383 m_text->setText( text );
377 384
378 QRect size = m_text->boundingRect(); 385 QRect size = m_text->boundingRect();
379 m_text->move( ( FIELD_WIDTH*TILE_SIZE - size.width() ) / 2, 386 m_text->move( ( FIELD_WIDTH*TILE_SIZE - size.width() ) / 2,
380 ( FIELD_HEIGHT*TILE_SIZE - size.height() ) / 2 ); 387 ( FIELD_HEIGHT*TILE_SIZE - size.height() ) / 2 );
381 388
382 m_text->show(); 389 m_text->show();
383 } else 390 } else
384 { 391 {
385 m_text->hide(); 392 m_text->hide();
386 } 393 }
387} 394}
388 395
389void JezzGame::start() 396void JezzGame::start()
390{ 397{
391 m_running = true; 398 m_running = true;
392} 399}
393 400
394void JezzGame::stop() 401void JezzGame::stop()
diff --git a/noncore/games/go/go.pro b/noncore/games/go/go.pro
index b73bbb0..72425a5 100644
--- a/noncore/games/go/go.pro
+++ b/noncore/games/go/go.pro
@@ -1,19 +1,18 @@
1 CONFIG = qt warn_on quick-app 1 CONFIG = qt warn_on quick-app
2 HEADERS = amigo.h \ 2 HEADERS = amigo.h \
3 go.h \ 3 go.h \
4 goplayutils.h \ 4 goplayutils.h \
5 gowidget.h 5 gowidget.h
6 SOURCES = amigo.c \ 6 SOURCES = amigo.c \
7 goplayer.c \ 7 goplayer.c \
8 goplayutils.c \ 8 goplayutils.c \
9 killable.c \ 9 killable.c \
10 gowidget.cpp \ 10 gowidget.cpp \
11 main.cpp 11 main.cpp
12INCLUDEPATH += $(OPIEDIR)/include 12INCLUDEPATH += $(OPIEDIR)/include
13 DEPENDPATH+= $(OPIEDIR)/include 13 DEPENDPATH+= $(OPIEDIR)/include
14LIBS += -lqpe -lopiecore2 14LIBS += -lqpe -lopiecore2
15 TARGET = go 15 TARGET = go
16 16
17 17
18
19include ( $(OPIEDIR)/include.pro ) 18include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/games/go/gowidget.cpp b/noncore/games/go/gowidget.cpp
index d134540..ec03c1d 100644
--- a/noncore/games/go/gowidget.cpp
+++ b/noncore/games/go/gowidget.cpp
@@ -1,59 +1,60 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
8** Foundation and appearing in the file LICENSE.GPL included in the 8** Foundation and appearing in the file LICENSE.GPL included in the
9** packaging of this file. 9** packaging of this file.
10** 10**
11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 11** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 12** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
13** 13**
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#include "gowidget.h" 21#include "gowidget.h"
22 22
23/* OPIE */
24#include <opie2/odebug.h>
23#include <qpe/config.h> 25#include <qpe/config.h>
24#include <qpe/resource.h> 26#include <qpe/resource.h>
27using namespace Opie::Core;
25 28
29/* QT */
26#include <qpainter.h> 30#include <qpainter.h>
27#include <qtoolbar.h> 31#include <qtoolbar.h>
28#include <qmenubar.h> 32#include <qmenubar.h>
29#include <qaction.h> 33#include <qaction.h>
30#include <qapplication.h> //processEvents() 34#include <qapplication.h> //processEvents()
31#include <qlabel.h> 35#include <qlabel.h>
32 36
33//#include <stdio.h>
34
35
36static const enum bVal computer_color = BLACK; 37static const enum bVal computer_color = BLACK;
37 38
38static int current_handicap = 1; 39static int current_handicap = 1;
39 40
40static QBrush *goBrush; 41static QBrush *goBrush;
41//static QImage *newBlackStone; 42//static QImage *newBlackStone;
42//static QImage *blackStone; 43//static QImage *blackStone;
43//static QImage *whiteStone; 44//static QImage *whiteStone;
44static QPixmap *newBlackStone; 45static QPixmap *newBlackStone;
45static QPixmap *blackStone; 46static QPixmap *blackStone;
46static QPixmap *whiteStone; 47static QPixmap *whiteStone;
47 48
48static bool smallStones = FALSE; 49static bool smallStones = FALSE;
49 50
50GoMainWidget::GoMainWidget( QWidget *parent, const char* name, WFlags fl) : 51GoMainWidget::GoMainWidget( QWidget *parent, const char* name, WFlags fl) :
51 QMainWindow( parent, name, fl ) 52 QMainWindow( parent, name, fl )
52{ 53{
53 setToolBarsMovable( FALSE ); 54 setToolBarsMovable( FALSE );
54 GoWidget *go = new GoWidget(this); 55 GoWidget *go = new GoWidget(this);
55 56
56 setCentralWidget(go); 57 setCentralWidget(go);
57 toolbar = new QToolBar(this); 58 toolbar = new QToolBar(this);
58 toolbar->setHorizontalStretchable( TRUE ); 59 toolbar->setHorizontalStretchable( TRUE );
59 addToolBar(toolbar); 60 addToolBar(toolbar);
@@ -427,34 +428,34 @@ void GoWidget::setTwoplayer( bool b )
427{ 428{
428 twoplayer = b; 429 twoplayer = b;
429} 430}
430 431
431void GoWidget::setHandicap( int h ) 432void GoWidget::setHandicap( int h )
432{ 433{
433 current_handicap = h; 434 current_handicap = h;
434} 435}
435 436
436 437
437extern "C" { 438extern "C" {
438 439
439 voidremovestone(short x, short y) 440 voidremovestone(short x, short y)
440{ 441{
441 GoWidget::self->removeStone(x,y); 442 GoWidget::self->removeStone(x,y);
442} 443}
443 444
444 voidplacestone (enum bVal c, short x, short y ) 445 voidplacestone (enum bVal c, short x, short y )
445{ 446{
446 GoWidget::self->placeStone(c,x,y); 447 GoWidget::self->placeStone(c,x,y);
447} 448}
448 449
449 voidintrMoveReport(enum bVal c ,char *coord ,char *reason ) 450 voidintrMoveReport(enum bVal c ,char *coord ,char *reason )
450{ 451{
451 qDebug( "intrMoveReport colour %d, %s %s", c, coord, reason ); 452 odebug << "intrMoveReport colour " << c << ", " << coord << " " << reason << "" << oendl;
452} 453}
453 454
454 voidintrPrisonerReport( short blackcnt, short whitecnt ) 455 voidintrPrisonerReport( short blackcnt, short whitecnt )
455{ 456{
456 GoWidget::self->reportPrisoners(blackcnt,whitecnt); 457 GoWidget::self->reportPrisoners(blackcnt,whitecnt);
457} 458}
458 459
459} 460}
460 461
diff --git a/noncore/games/kpacman/kpacman.pro b/noncore/games/kpacman/kpacman.pro
index 8453f78..45314f9 100644
--- a/noncore/games/kpacman/kpacman.pro
+++ b/noncore/games/kpacman/kpacman.pro
@@ -1,41 +1,39 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 #CONFIG = qt warn_on
3 CONFIG = qt warn_on 2 CONFIG = qt warn_on
4 #TMAKE_CXXFLAGS+=
5 HEADERS = kpacmanwidget.h \ 3 HEADERS = kpacmanwidget.h \
6 referee.h \ 4 referee.h \
7 status.h \ 5 status.h \
8 painter.h \ 6 painter.h \
9 score.h \ 7 score.h \
10 pacman.h \ 8 pacman.h \
11 monster.h \ 9 monster.h \
12 keys.h \ 10 keys.h \
13 fruit.h \ 11 fruit.h \
14 energizer.h \ 12 energizer.h \
15 board.h \ 13 board.h \
16 bitfont.h \ 14 bitfont.h \
17 kpacman.h \ 15 kpacman.h \
18 bitmaps.h \ 16 bitmaps.h \
19 colors.h \ 17 colors.h \
20 portable.h 18 portable.h
21 SOURCES = kpacmanwidget.cpp \ 19 SOURCES = kpacmanwidget.cpp \
22 referee.cpp \ 20 referee.cpp \
23 status.cpp \ 21 status.cpp \
24 painter.cpp \ 22 painter.cpp \
25 score.cpp \ 23 score.cpp \
26 pacman.cpp \ 24 pacman.cpp \
27 monster.cpp \ 25 monster.cpp \
28 keys.cpp \ 26 keys.cpp \
29 fruit.cpp \ 27 fruit.cpp \
30 energizer.cpp \ 28 energizer.cpp \
31 board.cpp \ 29 board.cpp \
32 bitfont.cpp \ 30 bitfont.cpp \
33 kpacman.cpp \ 31 kpacman.cpp \
34 main.cpp 32 main.cpp
35 INCLUDEPATH+= $(OPIEDIR)/include 33 INCLUDEPATH+= $(OPIEDIR)/include
36 DEPENDPATH+= $(OPIEDIR)/include 34 DEPENDPATH+= $(OPIEDIR)/include
37LIBS += -lqpe 35LIBS += -lqpe -lopiecore2
38DESTDIR = $(OPIEDIR)/bin 36DESTDIR = $(OPIEDIR)/bin
39 TARGET = kpacman 37 TARGET = kpacman
40 38
41include ( $(OPIEDIR)/include.pro ) 39include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/games/kpacman/kpacmanwidget.cpp b/noncore/games/kpacman/kpacmanwidget.cpp
index 9631495..b59dd02 100644
--- a/noncore/games/kpacman/kpacmanwidget.cpp
+++ b/noncore/games/kpacman/kpacmanwidget.cpp
@@ -1,40 +1,41 @@
1 1
2#include "portable.h" 2#include "portable.h"
3 3
4#if defined( KDE2_PORT ) 4#if defined( KDE2_PORT )
5#include <kapp.h> 5#include <kapp.h>
6#include <kconfig.h> 6#include <kconfig.h>
7#include <kstddirs.h> 7#include <kstddirs.h>
8#include <kpacmanwidget.h> 8#include <kpacmanwidget.h>
9#include <kpacmanwidget.moc> 9#include <kpacmanwidget.moc>
10#elif defined( QPE_PORT ) 10#elif defined( QPE_PORT )
11#include <qpe/qpeapplication.h> 11#include <qpe/qpeapplication.h>
12#include <qpe/config.h> 12#include <qpe/config.h>
13#include "kpacmanwidget.h" 13#include "kpacmanwidget.h"
14#endif 14#endif
15 15
16 16#include <opie2/odebug.h>
17using namespace Opie::Core;
17 18
18KpacmanWidget::KpacmanWidget( QWidget *parent, const char *name) 19KpacmanWidget::KpacmanWidget( QWidget *parent, const char *name)
19 : QWidget( parent, name ) 20 : QWidget( parent, name )
20{ 21{
21 score = 0l; 22 score = 0l;
22 referee = 0l; 23 referee = 0l;
23 status = 0l; 24 status = 0l;
24 bitfont = NULL; 25 bitfont = NULL;
25 fontName = ""; 26 fontName = "";
26 27
27 scheme = mode = -1; 28 scheme = mode = -1;
28 confScheme(); 29 confScheme();
29 30
30 score = new Score(this, name, scheme, mode, bitfont); 31 score = new Score(this, name, scheme, mode, bitfont);
31 referee = new Referee( this, name, scheme, mode, bitfont); 32 referee = new Referee( this, name, scheme, mode, bitfont);
32 status = new Status(this, name, scheme, mode); 33 status = new Status(this, name, scheme, mode);
33 34
34 setBackgroundColor( black ); 35 setBackgroundColor( black );
35} 36}
36 37
37KpacmanWidget::~KpacmanWidget() 38KpacmanWidget::~KpacmanWidget()
38{ 39{
39} 40}
40 41
@@ -118,36 +119,36 @@ void KpacmanWidget::confScheme()
118 } 119 }
119 120
120 RESTORE_CONFIG_GROUP( cfg, oldgroup ); 121 RESTORE_CONFIG_GROUP( cfg, oldgroup );
121 APP_CONFIG_END( cfg ); 122 APP_CONFIG_END( cfg );
122} 123}
123 124
124void KpacmanWidget::setScheme(int Scheme, int Mode) 125void KpacmanWidget::setScheme(int Scheme, int Mode)
125{ 126{
126 mode = Mode; 127 mode = Mode;
127 scheme = Scheme; 128 scheme = Scheme;
128 129
129 confScheme(); 130 confScheme();
130 131
131 score->setScheme(Scheme, Mode, bitfont); 132 score->setScheme(Scheme, Mode, bitfont);
132 referee->setScheme(Scheme, Mode, bitfont); 133 referee->setScheme(Scheme, Mode, bitfont);
133 status->setScheme(Scheme, Mode); 134 status->setScheme(Scheme, Mode);
134 135
135 score->repaint(FALSE); 136 score->repaint(FALSE);
136 referee->repaint(FALSE); 137 referee->repaint(FALSE);
137 status->repaint(FALSE); 138 status->repaint(FALSE);
138} 139}
139 140
140void KpacmanWidget::resizeEvent( QResizeEvent * ) 141void KpacmanWidget::resizeEvent( QResizeEvent * )
141{ 142{
142 qWarning("Resize"); 143 owarn << "Resize" << oendl;
143 referee->setGeometry(0, bitfont->height()*3, referee->width(), referee->height()); 144 referee->setGeometry(0, bitfont->height()*3, referee->width(), referee->height());
144 referee->setBackgroundColor(BLACK); 145 referee->setBackgroundColor(BLACK);
145 146
146 if(!status ) return; 147 if(!status ) return;
147 status->setGeometry(0, bitfont->height()*3+referee->height(), referee->width(), 148 status->setGeometry(0, bitfont->height()*3+referee->height(), referee->width(),
148 status->height()); 149 status->height());
149 status->setBackgroundColor(BLACK); 150 status->setBackgroundColor(BLACK);
150 151
151 score->setGeometry(0, 0, referee->width(), bitfont->height()*3+referee->height()+status->height()); 152 score->setGeometry(0, 0, referee->width(), bitfont->height()*3+referee->height()+status->height());
152 score->setBackgroundColor(BLACK); 153 score->setBackgroundColor(BLACK);
153} 154}
diff --git a/noncore/games/kpacman/status.cpp b/noncore/games/kpacman/status.cpp
index 02ff63d..db6938e 100644
--- a/noncore/games/kpacman/status.cpp
+++ b/noncore/games/kpacman/status.cpp
@@ -1,47 +1,50 @@
1 1
2#include "portable.h" 2#include "portable.h"
3 3
4#if defined( KDE2_PORT ) 4#if defined( KDE2_PORT )
5#include <kapp.h> 5#include <kapp.h>
6#include <klocale.h> 6#include <klocale.h>
7#include <kstddirs.h> 7#include <kstddirs.h>
8#include <status.h> 8#include <status.h>
9#include <status.moc> 9#include <status.moc>
10#elif defined( QPE_PORT ) 10#elif defined( QPE_PORT )
11#include <qpe/qpeapplication.h> 11#include <qpe/qpeapplication.h>
12#include <qpe/config.h> 12#include <qpe/config.h>
13#include "status.h" 13#include "status.h"
14#endif 14#endif
15 15
16#include <opie2/odebug.h>
17using namespace Opie::Core;
18
16#include <qbitmap.h> 19#include <qbitmap.h>
17#include <qmsgbox.h> 20#include <qmsgbox.h>
18#include <qfileinfo.h> 21#include <qfileinfo.h>
19 22
20Status::Status( QWidget *parent, const char *name, int Scheme, int Mode ) : 23Status::Status( QWidget *parent, const char *name, int Scheme, int Mode ) :
21 QWidget( parent, name ) 24 QWidget( parent, name )
22{ 25{
23 qWarning("Status::Status"); 26 owarn << "Status::Status" << oendl;
24 actualLifes = 0; 27 actualLifes = 0;
25 actualLevel = 0; 28 actualLevel = 0;
26 29
27 lifesPix = NULL; 30 lifesPix = NULL;
28 levelPix = NULL; 31 levelPix = NULL;
29 32
30 scheme = Scheme; 33 scheme = Scheme;
31 mode = Mode; 34 mode = Mode;
32 level = 0; 35 level = 0;
33 36
34 confScheme(); 37 confScheme();
35} 38}
36 39
37QList<QPixmap> *Status::loadPixmap(QWidget *parent, QString pixmapName, 40QList<QPixmap> *Status::loadPixmap(QWidget *parent, QString pixmapName,
38 QList<QPixmap> *pixmaps) 41 QList<QPixmap> *pixmaps)
39{ 42{
40 if (pixmaps == NULL) { 43 if (pixmaps == NULL) {
41 pixmaps = new QList<QPixmap>; 44 pixmaps = new QList<QPixmap>;
42 pixmaps->setAutoDelete(TRUE); 45 pixmaps->setAutoDelete(TRUE);
43 } 46 }
44 47
45 if (!pixmaps->isEmpty()) 48 if (!pixmaps->isEmpty())
46 pixmaps->clear(); 49 pixmaps->clear();
47 50
diff --git a/noncore/games/mindbreaker/mindbreaker.cpp b/noncore/games/mindbreaker/mindbreaker.cpp
index 2b924c6..1f554d2 100644
--- a/noncore/games/mindbreaker/mindbreaker.cpp
+++ b/noncore/games/mindbreaker/mindbreaker.cpp
@@ -69,49 +69,49 @@ static void setupBoardSize(int w, int h)
69 adjusted_bin_margin = w * 10/240; 69 adjusted_bin_margin = w * 10/240;
70 adjusted_peg_size = adjusted_panel_height*3/4; 70 adjusted_peg_size = adjusted_panel_height*3/4;
71 adjusted_answerpeg_size = QMIN(adjusted_panel_width*15/180,adjusted_panel_height*15/25); 71 adjusted_answerpeg_size = QMIN(adjusted_panel_width*15/180,adjusted_panel_height*15/25);
72 72
73 // looks a bit dodgy on larger sizes 73 // looks a bit dodgy on larger sizes
74 if ( adjusted_peg_size > 40 ) 74 if ( adjusted_peg_size > 40 )
75 adjusted_peg_size = 40; 75 adjusted_peg_size = 40;
76 76
77 adjusted_first_peg_x_diff = w * 31/240-adjusted_peg_size/2; 77 adjusted_first_peg_x_diff = w * 31/240-adjusted_peg_size/2;
78 adjusted_first_peg_y_diff = (adjusted_panel_height - adjusted_peg_size)/2; 78 adjusted_first_peg_y_diff = (adjusted_panel_height - adjusted_peg_size)/2;
79 adjusted_peg_spacing = w * 30/240; 79 adjusted_peg_spacing = w * 30/240;
80 80
81 // looks a bit dodgy on larger sizes (still does though, but not as much...) 81 // looks a bit dodgy on larger sizes (still does though, but not as much...)
82 if ( adjusted_answerpeg_size > 22 ) 82 if ( adjusted_answerpeg_size > 22 )
83 adjusted_answerpeg_size = 22; 83 adjusted_answerpeg_size = 22;
84 84
85 adjusted_answerpegx = adjusted_panel_width * 159/180 - adjusted_answerpeg_size/2; 85 adjusted_answerpegx = adjusted_panel_width * 159/180 - adjusted_answerpeg_size/2;
86 adjusted_answerpegy = adjusted_panel_height/3 - adjusted_answerpeg_size/2; 86 adjusted_answerpegy = adjusted_panel_height/3 - adjusted_answerpeg_size/2;
87 adjusted_answerpeg_xdiff = adjusted_panel_width * 10/180; 87 adjusted_answerpeg_xdiff = adjusted_panel_width * 10/180;
88 adjusted_answerpeg_ydiff = adjusted_panel_height * 9/25; 88 adjusted_answerpeg_ydiff = adjusted_panel_height * 9/25;
89 89
90 adjusted_board_height = adjusted_title_height + (adjusted_panel_height * 9); 90 adjusted_board_height = adjusted_title_height + (adjusted_panel_height * 9);
91 adjusted_board_width = adjusted_panel_width + (adjusted_bin_margin * 2) + adjusted_peg_size; 91 adjusted_board_width = adjusted_panel_width + (adjusted_bin_margin * 2) + adjusted_peg_size;
92 92
93// qDebug("Adjusted width %d height %d", adjusted_board_width, adjusted_board_height); 93// odebug << "Adjusted width " << adjusted_board_width << " height " << adjusted_board_height << "" << oendl;
94} 94}
95 95
96 96
97/* helper class, */ 97/* helper class, */
98class Peg : public QCanvasRectangle 98class Peg : public QCanvasRectangle
99{ 99{
100public: 100public:
101 Peg(QCanvas *canvas, int type, int go = -1, int pos = -1); 101 Peg(QCanvas *canvas, int type, int go = -1, int pos = -1);
102 int rtti() const {return pegRTTI; } 102 int rtti() const {return pegRTTI; }
103 void advance(int phase); 103 void advance(int phase);
104 104
105 bool hit( const QPoint &) const; 105 bool hit( const QPoint &) const;
106 106
107/* a placed peg is one that has been set down on the board correctly and 107/* a placed peg is one that has been set down on the board correctly and
108 should not be moved, only copied */ 108 should not be moved, only copied */
109 bool placed() const; 109 bool placed() const;
110 void setPlaced(bool); 110 void setPlaced(bool);
111 111
112 int pegGo() const; 112 int pegGo() const;
113 int pegPos() const; 113 int pegPos() const;
114 void setPegPos(int); 114 void setPegPos(int);
115 115
116 int type() const; 116 int type() const;
117 117
diff --git a/noncore/games/oyatzee/oyatzee.cpp b/noncore/games/oyatzee/oyatzee.cpp
index a55aa73..27c0a9f 100644
--- a/noncore/games/oyatzee/oyatzee.cpp
+++ b/noncore/games/oyatzee/oyatzee.cpp
@@ -1,68 +1,74 @@
1#include "oyatzee.h" 1#include "oyatzee.h"
2 2
3/* OPIE */
4#include <opie2/odebug.h>
5using namespace Opie::Core;
6
7/* QT */
3#include <qmessagebox.h> 8#include <qmessagebox.h>
4#include <qpushbutton.h> 9#include <qpushbutton.h>
5#include <qpainter.h> 10#include <qpainter.h>
6#include <qlayout.h> 11#include <qlayout.h>
7 12
13/* STD */
8#include <stdlib.h> 14#include <stdlib.h>
9 15
10OYatzee::OYatzee( QWidget *parent , const char *name, WFlags fl ) : QMainWindow( parent , name , fl ) 16OYatzee::OYatzee( QWidget *parent , const char *name, WFlags fl ) : QMainWindow( parent , name , fl )
11{ 17{
12 QWidget *thing = new QWidget( this ); 18 QWidget *thing = new QWidget( this );
13 setCentralWidget( thing ); 19 setCentralWidget( thing );
14 20
15 setCaption( tr( "OYatzee" ) ); 21 setCaption( tr( "OYatzee" ) );
16 22
17 setPlayerNumber( 4 ); 23 setPlayerNumber( 4 );
18 setRoundsNumber( 1 ); 24 setRoundsNumber( 1 );
19 25
20 lastPlayerFinished = false; 26 lastPlayerFinished = false;
21 currentPlayer = 1; 27 currentPlayer = 1;
22 28
23 ps.append( new Player( "Carsten" ) ); 29 ps.append( new Player( "Carsten" ) );
24 ps.append( new Player( "Julia" ) ); 30 ps.append( new Player( "Julia" ) );
25 ps.append( new Player( "Christine" ) ); 31 ps.append( new Player( "Christine" ) );
26 ps.append( new Player( "Stephan" ) ); 32 ps.append( new Player( "Stephan" ) );
27 33
28 34
29 QVBoxLayout *vbox = new QVBoxLayout( thing ); 35 QVBoxLayout *vbox = new QVBoxLayout( thing );
30 36
31 sb = new Scoreboard( ps, thing , "sb" ); 37 sb = new Scoreboard( ps, thing , "sb" );
32 connect( sb->pb , SIGNAL( item(int) ), this , SLOT( slotEndRound(int) ) ); 38 connect( sb->pb , SIGNAL( item(int) ), this , SLOT( slotEndRound(int) ) );
33 39
34 dw = new DiceWidget( thing , "dw" ); 40 dw = new DiceWidget( thing , "dw" );
35 dw->setMaximumHeight( this->height()/4 ); 41 dw->setMaximumHeight( this->height()/4 );
36 connect( dw->rollButton, SIGNAL( clicked() ), this , SLOT( slotRollDices() ) ); 42 connect( dw->rollButton, SIGNAL( clicked() ), this , SLOT( slotRollDices() ) );
37 43
38 vbox->addWidget( sb ); 44 vbox->addWidget( sb );
39 vbox->addWidget( dw ); 45 vbox->addWidget( dw );
40} 46}
41 47
42void OYatzee::slotEndRound( int item ) 48void OYatzee::slotEndRound( int item )
43{ 49{
44 qDebug( "Der User hat Nummer %d ausgewählt" , item ); 50 odebug << "Der User hat Nummer " << item << " ausgewählt" << oendl;
45 51
46 /* 52 /*
47 * if the user clicked on Total, Bonus or Score and thus not on a 53 * if the user clicked on Total, Bonus or Score and thus not on a
48 * selectable item return and do nothing 54 * selectable item return and do nothing
49 */ 55 */
50 if ( item == 7 || item == 8 || item == 16 ) return; 56 if ( item == 7 || item == 8 || item == 16 ) return;
51 57
52 /* 58 /*
53 * check if the user can really click on that item 59 * check if the user can really click on that item
54 */ 60 */
55 if ( posibilities.find( item ) == posibilities.end() ) return; 61 if ( posibilities.find( item ) == posibilities.end() ) return;
56 62
57 QValueListInt numbers; 63 QValueListInt numbers;
58 64
59 Dice *d = dw->diceList.first(); 65 Dice *d = dw->diceList.first();
60 for ( ; d != 0 ; d = dw->diceList.next() ) 66 for ( ; d != 0 ; d = dw->diceList.next() )
61 { 67 {
62 numbers.append( d->hasValue() ); 68 numbers.append( d->hasValue() );
63 } 69 }
64 70
65 int points = 0; 71 int points = 0;
66 72
67 switch ( item ) 73 switch ( item )
68 { 74 {
@@ -88,96 +94,96 @@ void OYatzee::slotEndRound( int item )
88 points = oakPoints; 94 points = oakPoints;
89 break; 95 break;
90 case FourOfAKind: 96 case FourOfAKind:
91 points = oakPoints; 97 points = oakPoints;
92 break; 98 break;
93 case FullHouse: 99 case FullHouse:
94 points = 25; 100 points = 25;
95 break; 101 break;
96 case SStraight: 102 case SStraight:
97 points = 30; 103 points = 30;
98 break; 104 break;
99 case LStraight: 105 case LStraight:
100 points = 40; 106 points = 40;
101 break; 107 break;
102 case Yatzee: 108 case Yatzee:
103 points = 50; 109 points = 50;
104 break; 110 break;
105 case Chance: 111 case Chance:
106 points = getPoints ( Chance , numbers ); 112 points = getPoints ( Chance , numbers );
107 } 113 }
108 114
109 sb->nextRB(currentPlayer-1)->updateMap( item , points ); 115 sb->nextRB(currentPlayer-1)->updateMap( item , points );
110 nextPlayer(); 116 nextPlayer();
111 117
112 qDebug( "Punkte: %d" , points ); 118 odebug << "Punkte: " << points << "" << oendl;
113} 119}
114 120
115void OYatzee::nextPlayer() 121void OYatzee::nextPlayer()
116{ 122{
117 currentPlayer++; 123 currentPlayer++;
118 124
119 if ( currentPlayer > numOfPlayers ) 125 if ( currentPlayer > numOfPlayers )
120 { 126 {
121 currentPlayer = 1; 127 currentPlayer = 1;
122 } 128 }
123 129
124 ps.at(currentPlayer-1)->turn = 0; 130 ps.at(currentPlayer-1)->turn = 0;
125} 131}
126 132
127int OYatzee::getPoints( const int num , QValueListInt l) 133int OYatzee::getPoints( const int num , QValueListInt l)
128{ 134{
129 QValueListInt::Iterator it = l.begin(); 135 QValueListInt::Iterator it = l.begin();
130 int c = 0; 136 int c = 0;
131 137
132 if ( num != Chance ) 138 if ( num != Chance )
133 { 139 {
134 for ( ; it != l.end() ; ++it ) 140 for ( ; it != l.end() ; ++it )
135 { 141 {
136 if ( *it == num ) 142 if ( *it == num )
137 c++; 143 c++;
138 } 144 }
139 145
140 return c * num; 146 return c * num;
141 } 147 }
142 else 148 else
143 { 149 {
144 for ( ; it != l.end() ; ++it ) 150 for ( ; it != l.end() ; ++it )
145 { 151 {
146 c += *it; 152 c += *it;
147 } 153 }
148 return c; 154 return c;
149 } 155 }
150 } 156 }
151 157
152OYatzee::~OYatzee() 158OYatzee::~OYatzee()
153{ 159{
154} 160}
155 161
156void OYatzee::detectPosibilities() 162void OYatzee::detectPosibilities()
157{ 163{
158 posibilities.clear(); 164 posibilities.clear();
159 qDebug( "running detectPosibilities()" ); 165 odebug << "running detectPosibilities()" << oendl;
160 166
161 Dice *d = dw->diceList.first(); 167 Dice *d = dw->diceList.first();
162 168
163 QValueListInt numbers; 169 QValueListInt numbers;
164 170
165 for ( ; d != 0 ; d = dw->diceList.next() ) 171 for ( ; d != 0 ; d = dw->diceList.next() )
166 { 172 {
167 numbers.append( d->hasValue() ); 173 numbers.append( d->hasValue() );
168 } 174 }
169 175
170 //the 6 numbers 176 //the 6 numbers
171 QValueListInt::Iterator it; 177 QValueListInt::Iterator it;
172 178
173 for ( int i = 1 ; i < 7 ; ++i ) // check for 1-->6 179 for ( int i = 1 ; i < 7 ; ++i ) // check for 1-->6
174 { 180 {
175 bool cont = false; 181 bool cont = false;
176 it = numbers.begin(); 182 it = numbers.begin();
177 for ( ; it != numbers.end() ; ++it ) 183 for ( ; it != numbers.end() ; ++it )
178 { 184 {
179 if ( cont ) 185 if ( cont )
180 continue; 186 continue;
181 187
182 if ( numbers.find( i ) != numbers.end() ) 188 if ( numbers.find( i ) != numbers.end() )
183 { 189 {
@@ -240,179 +246,179 @@ void OYatzee::detectPosibilities()
240 isLong = true; 246 isLong = true;
241 } 247 }
242 //1234 248 //1234
243 if ( numbers.find( 1 ) != numbers.end() && numbers.find( 2 ) != numbers.end() ) 249 if ( numbers.find( 1 ) != numbers.end() && numbers.find( 2 ) != numbers.end() )
244 isShort = true; 250 isShort = true;
245 //3456 251 //3456
246 if ( numbers.find( 5 ) != numbers.end() && numbers.find( 6 ) != numbers.end() ) 252 if ( numbers.find( 5 ) != numbers.end() && numbers.find( 6 ) != numbers.end() )
247 isShort = true; 253 isShort = true;
248 254
249 if ( isShort ) 255 if ( isShort )
250 posibilities.append( 12 ); 256 posibilities.append( 12 );
251 if ( isLong ) 257 if ( isLong )
252 posibilities.append( 13 ); 258 posibilities.append( 13 );
253 } 259 }
254 260
255 posibilities.append( 13 ); //Chance, well, this is allways possible 261 posibilities.append( 13 ); //Chance, well, this is allways possible
256 262
257 displayPossibilites(); 263 displayPossibilites();
258} 264}
259 265
260void OYatzee::displayPossibilites() 266void OYatzee::displayPossibilites()
261{ 267{
262 //X for ( QValueListInt::Iterator it = posibilities.begin() ; it != posibilities.end(); ++it ) 268 //X for ( QValueListInt::Iterator it = posibilities.begin() ; it != posibilities.end(); ++it )
263 //X { 269 //X {
264 //X qDebug( QString::number( *it ) ); 270 //X odebug << QString::number( *it ) << oendl;
265 //X switch ( *it ) 271 //X switch ( *it )
266 //X { 272 //X {
267 //X case Ones: 273 //X case Ones:
268 //X qDebug( "1er" ); 274 //X odebug << "1er" << oendl;
269 //X break; 275 //X break;
270 //X case Twos: 276 //X case Twos:
271 //X qDebug( "2er" ); 277 //X odebug << "2er" << oendl;
272 //X break; 278 //X break;
273 //X case Threes: 279 //X case Threes:
274 //X qDebug( "3er" ); 280 //X odebug << "3er" << oendl;
275 //X break; 281 //X break;
276 //X case Fours: 282 //X case Fours:
277 //X qDebug( "4er" ); 283 //X odebug << "4er" << oendl;
278 //X break; 284 //X break;
279 //X case Fives: 285 //X case Fives:
280 //X qDebug( "5er" ); 286 //X odebug << "5er" << oendl;
281 //X break; 287 //X break;
282 //X case Sixes: 288 //X case Sixes:
283 //X qDebug( "6er" ); 289 //X odebug << "6er" << oendl;
284 //X break; 290 //X break;
285 //X case ThreeOfAKind: 291 //X case ThreeOfAKind:
286 //X qDebug( "3oaK" ); 292 //X odebug << "3oaK" << oendl;
287 //X break; 293 //X break;
288 //X case FourOfAKind: 294 //X case FourOfAKind:
289 //X qDebug( "4oaK" ); 295 //X odebug << "4oaK" << oendl;
290 //X break; 296 //X break;
291 //X case FullHouse: 297 //X case FullHouse:
292 //X qDebug( "Full House" ); 298 //X odebug << "Full House" << oendl;
293 //X break; 299 //X break;
294 //X case SStraight: 300 //X case SStraight:
295 //X qDebug( "Short S" ); 301 //X odebug << "Short S" << oendl;
296 //X break; 302 //X break;
297 //X case LStraight: 303 //X case LStraight:
298 //X qDebug( "Long S" ); 304 //X odebug << "Long S" << oendl;
299 //X break; 305 //X break;
300 //X case Yatzee: 306 //X case Yatzee:
301 //X qDebug( "Yatzee!" ); 307 //X odebug << "Yatzee!" << oendl;
302 //X break; 308 //X break;
303 //X case Chance: 309 //X case Chance:
304 //X qDebug( "Chance" ); 310 //X odebug << "Chance" << oendl;
305 //X break; 311 //X break;
306 //X } 312 //X }
307 //X } 313 //X }
308 314
309 sb->pb->setIntlist( posibilities ); 315 sb->pb->setIntlist( posibilities );
310 sb->pb->update(); 316 sb->pb->update();
311} 317}
312 318
313void OYatzee::startGame() 319void OYatzee::startGame()
314{ 320{
315 /* 321 /*
316 * TODO 322 * TODO
317 */ 323 */
318} 324}
319 325
320void OYatzee::stopGame(){} 326void OYatzee::stopGame(){}
321 327
322void OYatzee::setPlayerNumber( const int num ) 328void OYatzee::setPlayerNumber( const int num )
323{ 329{
324 numOfPlayers = num; 330 numOfPlayers = num;
325} 331}
326 332
327void OYatzee::setRoundsNumber( const int num ) 333void OYatzee::setRoundsNumber( const int num )
328{ 334{
329 numOfRounds = num; 335 numOfRounds = num;
330} 336}
331 337
332void OYatzee::slotStartGame() 338void OYatzee::slotStartGame()
333{ 339{
334} 340}
335 341
336void OYatzee::slotRollDices() 342void OYatzee::slotRollDices()
337{ 343{
338 qDebug( "Roll nummer: %d" , ps.at( currentPlayer-1 )->turn ); 344 odebug << "Roll nummer: " << ps.at( currentPlayer-1 )->turn << "" << oendl;
339 345
340 if ( ps.at( currentPlayer-1 )->turn == 3 ) 346 if ( ps.at( currentPlayer-1 )->turn == 3 )
341 { 347 {
342 QMessageBox::information( this, 348 QMessageBox::information( this,
343 "OYatzee", 349 "OYatzee",
344 tr( "Only three rolls per turn allowed." ) ); 350 tr( "Only three rolls per turn allowed." ) );
345 return; 351 return;
346 } 352 }
347 353
348 Dice *d = dw->diceList.first(); 354 Dice *d = dw->diceList.first();
349 355
350 for ( ; d != 0 ; d = dw->diceList.next() ) 356 for ( ; d != 0 ; d = dw->diceList.next() )
351 { 357 {
352 if ( !d->isSelected ) 358 if ( !d->isSelected )
353 d->roll(); 359 d->roll();
354 } 360 }
355 361
356 //qDebug( "Roll nummer (vorher): %d" , ps.at( currentPlayer-1 )->turn ); 362 //odebug << "Roll nummer (vorher): " << ps.at( currentPlayer-1 )->turn << "" << oendl;
357 ps.at(currentPlayer-1)->turn++; 363 ps.at(currentPlayer-1)->turn++;
358 //qDebug( "Roll nummer (nachher): %d" , ps.at( currentPlayer-1 )->turn ); 364 //odebug << "Roll nummer (nachher): " << ps.at( currentPlayer-1 )->turn << "" << oendl;
359 365
360 detectPosibilities(); 366 detectPosibilities();
361} 367}
362 368
363/* 369/*
364 * Scoreboard 370 * Scoreboard
365 */ 371 */
366Scoreboard::Scoreboard( playerList ps, QWidget *parent, const char *name ) : QWidget( parent , name ) 372Scoreboard::Scoreboard( playerList ps, QWidget *parent, const char *name ) : QWidget( parent , name )
367{ 373{
368 ps_ = ps; 374 ps_ = ps;
369 375
370 pb = new Possibilityboard( this , "pb" ); 376 pb = new Possibilityboard( this , "pb" );
371 377
372 createResultboards( 4 ); 378 createResultboards( 4 );
373 379
374 QHBoxLayout *hbox = new QHBoxLayout( this ); 380 QHBoxLayout *hbox = new QHBoxLayout( this );
375 381
376 hbox->addWidget( pb ); 382 hbox->addWidget( pb );
377 383
378 hbox->addSpacing( 25 ); 384 hbox->addSpacing( 25 );
379 385
380 Resultboard *r = rbList.first(); 386 Resultboard *r = rbList.first();
381 387
382 for ( ; r != 0 ; r = rbList.next() ) 388 for ( ; r != 0 ; r = rbList.next() )
383 { 389 {
384 hbox->addWidget( r ); 390 hbox->addWidget( r );
385 } 391 }
386} 392}
387 393
388Resultboard* Scoreboard::nextRB( int currentPlayer ) 394Resultboard* Scoreboard::nextRB( int currentPlayer )
389{ 395{
390 Resultboard *b; 396 Resultboard *b;
391 397
392 b = rbList.at( currentPlayer ); 398 b = rbList.at( currentPlayer );
393 399
394 qDebug( "Anzahl: %d" ,rbList.count() ); 400 odebug << "Anzahl: " << rbList.count() << "" << oendl;
395 401
396 return b; 402 return b;
397 } 403 }
398 404
399void Scoreboard::createResultboards(const int num) 405void Scoreboard::createResultboards(const int num)
400{ 406{
401 Player *p = ps_.first(); 407 Player *p = ps_.first();
402 for ( int i = 0 ; i < num ; ++i , p = ps_.next() ) 408 for ( int i = 0 ; i < num ; ++i , p = ps_.next() )
403 { 409 {
404 QString n = p->playerName; 410 QString n = p->playerName;
405 rbList.append( new Resultboard( n , this ) ); 411 rbList.append( new Resultboard( n , this ) );
406 } 412 }
407} 413}
408 414
409void Scoreboard::paintEvent( QPaintEvent * ) 415void Scoreboard::paintEvent( QPaintEvent * )
410{ 416{
411 //X QPainter p; 417 //X QPainter p;
412 //X p.begin( this ); 418 //X p.begin( this );
413//X 419//X
414 //X p.drawRect( 0,0, this->width() , this->height() ); 420 //X p.drawRect( 0,0, this->width() , this->height() );
415} 421}
416 422
417/* 423/*
418 * Dice 424 * Dice
@@ -587,49 +593,49 @@ void Board::mousePressEvent( QMouseEvent *e )
587 emit clicked( e->pos() ); 593 emit clicked( e->pos() );
588} 594}
589 595
590/* 596/*
591 * Resultboard 597 * Resultboard
592 */ 598 */
593 599
594Resultboard::Resultboard( QString playerName , QWidget *parent , const char* name ) : Board ( parent , name ) 600Resultboard::Resultboard( QString playerName , QWidget *parent , const char* name ) : Board ( parent , name )
595{ 601{
596 pName = playerName; 602 pName = playerName;
597} 603}
598 604
599void Resultboard::paintEvent( QPaintEvent* ) 605void Resultboard::paintEvent( QPaintEvent* )
600{ 606{
601 QPainter p; 607 QPainter p;
602 p.begin( this ); 608 p.begin( this );
603 609
604 const int cell_width = this->width(); 610 const int cell_width = this->width();
605 const int cell_height = this->height()/17; 611 const int cell_height = this->height()/17;
606 612
607 pointMap::Iterator it = pMap.begin(); 613 pointMap::Iterator it = pMap.begin();
608 for ( ; it != pMap.end() ; ++it ) 614 for ( ; it != pMap.end() ; ++it )
609 { 615 {
610 int i = it.key(); 616 int i = it.key();
611 qDebug( "ok: %d , %d" , i , it.data() ); 617 odebug << "ok: " << i << " , " << it.data() << "" << oendl;
612 p.drawText( 0, i*cell_height , cell_width , cell_height , Qt::AlignCenter , QString::number( it.data() ) ); 618 p.drawText( 0, i*cell_height , cell_width , cell_height , Qt::AlignCenter , QString::number( it.data() ) );
613 } 619 }
614 620
615 p.drawText( 0,0,cell_width,cell_height, Qt::AlignCenter , pName ); //Playername 621 p.drawText( 0,0,cell_width,cell_height, Qt::AlignCenter , pName ); //Playername
616} 622}
617 623
618 624
619void Resultboard::updateMap( int item , int points ) 625void Resultboard::updateMap( int item , int points )
620{ 626{
621 pMap.insert( item , points ); 627 pMap.insert( item , points );
622 628
623 update(); 629 update();
624} 630}
625 631
626/* 632/*
627 * Possibilityboard 633 * Possibilityboard
628 */ 634 */
629 635
630Possibilityboard::Possibilityboard( QWidget *parent , const char* name ) : Board ( parent , name ) 636Possibilityboard::Possibilityboard( QWidget *parent , const char* name ) : Board ( parent , name )
631{ 637{
632 begriffe.append( "1er" ); 638 begriffe.append( "1er" );
633 begriffe.append( "2er" ); 639 begriffe.append( "2er" );
634 begriffe.append( "3er" ); 640 begriffe.append( "3er" );
635 begriffe.append( "4er" ); 641 begriffe.append( "4er" );
diff --git a/noncore/games/oyatzee/oyatzee.pro b/noncore/games/oyatzee/oyatzee.pro
index 754abd2..f505c66 100644
--- a/noncore/games/oyatzee/oyatzee.pro
+++ b/noncore/games/oyatzee/oyatzee.pro
@@ -1,11 +1,11 @@
1 TEMPLATE= app 1 TEMPLATE= app
2 CONFIG = qt warn_on 2 CONFIG = qt warn_on
3 DESTDIR = $(OPIEDIR)/bin 3 DESTDIR = $(OPIEDIR)/bin
4 HEADERS = oyatzee.h 4 HEADERS = oyatzee.h
5 SOURCES = main.cpp oyatzee.cpp 5 SOURCES = main.cpp oyatzee.cpp
6 TARGET = oyatzee 6 TARGET = oyatzee
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8 DEPENDPATH+= $(OPIEDIR)/include 8 DEPENDPATH+= $(OPIEDIR)/include
9LIBS += -lqpe 9LIBS += -lqpe -lopiecore2
10 10
11include ( $(OPIEDIR)/include.pro ) 11include ( $(OPIEDIR)/include.pro )
diff --git a/noncore/games/wordgame/wordgame.cpp b/noncore/games/wordgame/wordgame.cpp
index a80bd35..47d6725 100644
--- a/noncore/games/wordgame/wordgame.cpp
+++ b/noncore/games/wordgame/wordgame.cpp
@@ -654,49 +654,49 @@ void ComputerPlayer::findBest(QPoint at, const QPoint& d, const QDawg::Node* nod
654 // keep looking 654 // keep looking
655 blused--; 655 blused--;
656 used &= ~msk; // unmark 656 used &= ~msk; // unmark
657 } else { 657 } else {
658 break; 658 break;
659 } 659 }
660 } 660 }
661 } 661 }
662 msk <<= 1; 662 msk <<= 1;
663 } 663 }
664 } 664 }
665 // #### text()[1]... 665 // #### text()[1]...
666 } 666 }
667 findBest(at, d, node->next(), used, nletter, tiles, n, blankvalues, blused); 667 findBest(at, d, node->next(), used, nletter, tiles, n, blankvalues, blused);
668} 668}
669 669
670void ComputerPlayer::noteChoice(const Tile** tiles, int n, const QPoint& d, const Tile* blankvalues, int blused) 670void ComputerPlayer::noteChoice(const Tile** tiles, int n, const QPoint& d, const Tile* blankvalues, int blused)
671{ 671{
672 int s = board->score(current, tiles, n, blankvalues, d, TRUE, 0); 672 int s = board->score(current, tiles, n, blankvalues, d, TRUE, 0);
673/* 673/*
674if (s>0 || current==QPoint(5,1)){ 674if (s>0 || current==QPoint(5,1)){
675QString st; 675QString st;
676for ( int i=0; i<n; i++ ) 676for ( int i=0; i<n; i++ )
677 st += tiles[i]->text(); 677 st += tiles[i]->text();
678qDebug("%d,%d: %s (%d) for %d",current.x(),current.y(),st.latin1(),n,s); 678odebug << "" << current.x() << "," << current.y() << ": " << st.latin1() << " (" << n << ") for " << s << "" << oendl;
679} 679}
680*/ 680*/
681 if ( s > best_score ) { 681 if ( s > best_score ) {
682 int i; 682 int i;
683 for ( i=0; i<n; i++ ) 683 for ( i=0; i<n; i++ )
684 best[i] = tiles[i]; 684 best[i] = tiles[i];
685 for ( i=0; i<blused; i++ ) 685 for ( i=0; i<blused; i++ )
686 best_blankvalues[i] = blankvalues[i]; 686 best_blankvalues[i] = blankvalues[i];
687 best_n = n; 687 best_n = n;
688 best_blused = blused; 688 best_blused = blused;
689 best_score = s; 689 best_score = s;
690 best_dir = d; 690 best_dir = d;
691 best_start = current; 691 best_start = current;
692 } 692 }
693} 693}
694 694
695int TileItem::smallWidth() 695int TileItem::smallWidth()
696{ 696{
697 return tile_smallw; 697 return tile_smallw;
698} 698}
699 699
700int TileItem::smallHeight() 700int TileItem::smallHeight()
701{ 701{
702 return tile_smallh; 702 return tile_smallh;