summaryrefslogtreecommitdiff
path: root/noncore/games/backgammon
Side-by-side diff
Diffstat (limited to 'noncore/games/backgammon') (more/less context) (show whitespace changes)
-rw-r--r--noncore/games/backgammon/backgammon.cpp16
-rw-r--r--noncore/games/backgammon/moveengine.cpp2
2 files changed, 11 insertions, 7 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,48 +1,52 @@
#include "backgammon.h"
-
#include "aidialog.h"
#include "filedialog.h"
#include "playerdialog.h"
#include "rulesdialog.h"
#include "themedialog.h"
+/* OPIE */
+#include <opie2/odebug.h>
+#include <qpe/qpeapplication.h>
+#include <qpe/config.h>
+#include <qpe/resource.h>
+using namespace Opie::Core;
+
+/* QT */
#include <qfile.h>
#include <qlayout.h>
#include <qmessagebox.h>
#include <qtimer.h>
-#include <qpe/qpeapplication.h>
-#include <qpe/config.h>
#include <qmenubar.h>
-#include <qpe/resource.h>
#include <stdlib.h>
BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
: QMainWindow(parent, name, fl)
{
if (!name) setName("BackGammon");
setCaption(tr( "Backgammon") );
setIcon( Resource::loadPixmap( "backgammon" ) );
//general counter varaible
int a=0;
//the game engine
move=new MoveEngine();
//load the default theme
Config conf("backgammon");
if(!conf.isValid())
{
- qDebug("config file does not exist");
+ odebug << "config file does not exist" << oendl;
conf.setGroup("general");
conf.writeEntry("theme","default");
conf.setGroup("rules");
conf.writeEntry("move_with_pieces_out",false);
conf.writeEntry("nice_dice",false);
conf.setGroup("display");
conf.writeEntry("small",false);
conf.writeEntry("warning",true);
conf.setGroup("ai");
conf.writeEntry("rescue",6);
conf.writeEntry("eliminate",4);
conf.writeEntry("expose",1);
@@ -69,25 +73,25 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
ai.eliminate=conf.readNumEntry("eliminate",4);
ai.expose=conf.readNumEntry("expose",1);
ai.protect=conf.readNumEntry("protect",5);
ai.safe=conf.readNumEntry("safe",3);
ai.empty=conf.readNumEntry("empty",2);
move->setAISettings(ai);
//get the theme component names
Config theme(theme_file,Config::File);
if(!theme.isValid())
{
- qDebug("theme file does not exist");
+ odebug << "theme file does not exist" << oendl;
theme.setGroup("theme");
theme.writeEntry("board","casino_board_1");
theme.writeEntry("pieces1","casino_pieces_blue");
theme.writeEntry("pieces2","casino_pieces_white");
theme.writeEntry("dice1","casino_dice");
theme.writeEntry("dice2","casino_dice");
theme.writeEntry("table","casino_table_green");
theme.writeEntry("odds","casino_odds");
}
theme.setGroup("theme");
board_name=theme.readEntry("board","casino_board_1");
piecesA_name=theme.readEntry("pieces1","casino_pieces_blue");
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
@@ -448,25 +448,25 @@ int MoveEngine::getPossibleMoves()
}
int total=0;
for(int field=0;field<26;field++)
{
total+=moves[field].weight[0]+moves[field].weight[1]+moves[field].weight[2]+moves[field].weight[3];
}
return total;
}
void MoveEngine::move(const int& from, int to, const int& dice)
{
- //qDebug("%d moves from %d to %d (%d) with dice %d",player,from,to,to-from,dice);
+ //odebug << "" << player << " moves from " << from << " to " << to << " (" << to-from << ") with dice " << dice << "" << oendl;
if(player==1 && to==25)
to=26;
if(player==2 && to==0)
to=27;
//if space is occupied by enemy move pieces to startzone
if(fieldColor(to)==otherplayer)
{
population[to].total=0;
if(otherplayer==1)
population[0].total++;