summaryrefslogtreecommitdiff
path: root/noncore/games/backgammon/backgammon.cpp
authorzecke <zecke>2004-10-16 00:01:01 (UTC)
committer zecke <zecke>2004-10-16 00:01:01 (UTC)
commitdf14f647ff1a60ca82e0fa9bd91458be146153b8 (patch) (side-by-side diff)
tree4859961352851a4392e1442f2080c15bff8ad7bc /noncore/games/backgammon/backgammon.cpp
parent419f9710c488f56a7a117eb1529970d3371e0094 (diff)
downloadopie-df14f647ff1a60ca82e0fa9bd91458be146153b8.zip
opie-df14f647ff1a60ca82e0fa9bd91458be146153b8.tar.gz
opie-df14f647ff1a60ca82e0fa9bd91458be146153b8.tar.bz2
Replace QPEApplication::qpeDir() + "/ with
QPEApplication::qpeDir() + " as it is guranteed that qpeDir() will have '/' as the last charachter
Diffstat (limited to 'noncore/games/backgammon/backgammon.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/games/backgammon/backgammon.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/games/backgammon/backgammon.cpp b/noncore/games/backgammon/backgammon.cpp
index bdb1c78..c286a36 100644
--- a/noncore/games/backgammon/backgammon.cpp
+++ b/noncore/games/backgammon/backgammon.cpp
@@ -36,49 +36,49 @@ BackGammon::BackGammon(QWidget* parent, const char* name, WFlags fl)
//load the default theme
Config conf("backgammon");
if(!conf.isValid())
{
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);
conf.writeEntry("protect",5);
conf.writeEntry("safe",3);
conf.writeEntry("empty",2);
}
conf.setGroup("general");
theme_name=conf.readEntry("theme","default");
- QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme";
+ QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme";
//the rules
conf.setGroup("rules");
rules.move_with_pieces_out=conf.readBoolEntry("move_with_pieces_out",false);
rules.generous_dice=conf.readBoolEntry("nice_dice",false);
move->setRules(rules);
//get the AI settings
AISettings ai;
conf.setGroup("ai");
ai.rescue=conf.readNumEntry("rescue",6);
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())
{
@@ -307,230 +307,230 @@ void BackGammon::newgame()
dice4_played=true;
dice_rolled=false;
setplayer();
area->update();
}
void BackGammon::playerselect()
{
PlayerDialog* playerdialog=new PlayerDialog(this);
playerdialog->setAuto1(player1_auto);
playerdialog->setAuto2(player2_auto);
if(!playerdialog->exec())
return;
player1_auto=playerdialog->getAuto1();
player2_auto=playerdialog->getAuto2();
}
void BackGammon::loadgame()
{
FileDialog* file=new FileDialog(this,"Load Game",".game");
if(!file->exec())
return;
game_name=file->filename();
- QString game_file=QPEApplication::qpeDir()+"/backgammon/"+game_name+".game";
+ QString game_file=QPEApplication::qpeDir()+"backgammon/"+game_name+".game";
Config game(game_file,Config::File);
game.setGroup("dice");
diceA1_value=game.readNumEntry("diceA1_value");
diceA2_value=game.readNumEntry("diceA2_value");
diceA3_value=game.readNumEntry("diceA3_value");
diceA4_value=game.readNumEntry("diceA4_value");
diceB1_value=game.readNumEntry("diceB1_value");
diceB2_value=game.readNumEntry("diceB2_value");
diceB3_value=game.readNumEntry("diceB3_value");
diceB4_value=game.readNumEntry("diceB4_value");
player=game.readNumEntry("player");
dice1_played=game.readBoolEntry("dice1_played");
dice2_played=game.readBoolEntry("dice2_played");
dice3_played=game.readBoolEntry("dice3_played");
dice4_played=game.readBoolEntry("dice4_played");
dice_rolled=game.readBoolEntry("dice_rolled");
player1_auto=game.readBoolEntry("player1_auto");
player2_auto=game.readBoolEntry("player2_auto");
game.setGroup("pieces");
QString label;
LoadSave load;
for(int a=0;a<28;a++)
{
label.setNum(a);
load.pop[a].total = game.readNumEntry(label,0);
}
move->loadGame(load);
setplayer();
showdice();
draw();
area->update();
}
void BackGammon::savegame()
{
- QString game_file=QPEApplication::qpeDir()+"/backgammon/"+game_name+".game";
+ QString game_file=QPEApplication::qpeDir()+"backgammon/"+game_name+".game";
Config game(game_file,Config::File);
game.setGroup("dice");
game.writeEntry("diceA1_value",diceA1_value);
game.writeEntry("diceA2_value",diceA2_value);
game.writeEntry("diceA3_value",diceA3_value);
game.writeEntry("diceA4_value",diceA4_value);
game.writeEntry("diceB1_value",diceB1_value);
game.writeEntry("diceB2_value",diceB3_value);
game.writeEntry("diceB3_value",diceB4_value);
game.writeEntry("diceB4_value",diceB4_value);
game.writeEntry("player",player);
game.writeEntry("dice1_played",dice1_played);
game.writeEntry("dice2_played",dice2_played);
game.writeEntry("dice3_played",dice3_played);
game.writeEntry("dice4_played",dice4_played);
game.writeEntry("dice_rolled",dice_rolled);
game.writeEntry("player1_auto",player1_auto);
game.writeEntry("player2_auto",player2_auto);
game.setGroup("pieces");
QString label;
LoadSave save=move->saveGame();
for(int a=0;a<28;a++)
{
label.setNum(a);
game.writeEntry(label,save.pop[a].total);
}
QMessageBox::information(this,"Backgammon","Game saved","OK");
}
void BackGammon::deletegame()
{
FileDialog* file=new FileDialog(this,"Delete Game",".game");
if(!file->exec())
return;
game_name=file->filename();
- QString game_file=QPEApplication::qpeDir()+"/backgammon/"+game_name+".game";
+ QString game_file=QPEApplication::qpeDir()+"backgammon/"+game_name+".game";
if(!QMessageBox::warning(this,"Backgammon","deleted game\n"+game_name+" ?","OK","Cancel"))
{
QFile(game_file).remove();
}
}
void BackGammon::newtheme()
{
ThemeDialog* theme=new ThemeDialog(this);
ImageNames names;
names.theme=theme_name;
names.board=board_name;
names.pieces1=piecesA_name;
names.pieces2=piecesB_name;
names.dice1=diceA_name;
names.dice2=diceB_name;
names.odds=odds_name;
names.table=table_name;
theme->setCurrent(names);
if(!theme->exec())
return;
names=theme->getNames();
theme_name=names.theme;
board_name=names.board;
piecesA_name=names.pieces1;
piecesB_name=names.pieces2;
diceA_name=names.dice1;
diceB_name=names.dice2;
odds_name=names.odds;
table_name=names.table;
applytheme();
}
void BackGammon::loadtheme()
{
FileDialog* file=new FileDialog(this,"Load Theme",".theme");
if(!file->exec())
return;
theme_name=file->filename();
- QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme";
+ QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme";
Config theme(theme_file,Config::File);
theme.setGroup("theme");
board_name=theme.readEntry("board","board_1");
piecesA_name=theme.readEntry("pieces1","pieces_1");
piecesB_name=theme.readEntry("pieces2","pieces_2");
diceA_name=theme.readEntry("dice1","dice_1");
diceB_name=theme.readEntry("dice2","dice_2");
table_name=theme.readEntry("table","table_1");
odds_name=theme.readEntry("odds","odds_1");
applytheme();
}
void BackGammon::savetheme()
{
if(theme_name=="default")
{
QMessageBox::information(this,"Backgammon","Sorry\nCannot overwrite default.theme","OK");
return;
}
- QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme";
+ QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme";
if(QMessageBox::information(this,"Backgammon","Save Theme\n"+theme_name,"Yes","No"))
return;
Config theme(theme_file,Config::File);
theme.setGroup("theme");
theme.writeEntry("board",board_name);
theme.writeEntry("pieces1",piecesA_name);
theme.writeEntry("pieces2",piecesB_name);
theme.writeEntry("dice1",diceA_name);
theme.writeEntry("dice2",diceB_name);
theme.writeEntry("table",table_name);
theme.writeEntry("odds",odds_name);
}
void BackGammon::themedefault()
{
if(QMessageBox::information(this,"Backgammon","Make Theme\n"+theme_name+"\nthe default theme","Yes","No"))
return;
Config conf("backgammon");
conf.setGroup("general");
conf.writeEntry("theme",theme_name);
}
void BackGammon::deletetheme()
{
FileDialog* file=new FileDialog(this,"Delete Theme",".theme");
if(!file->exec())
return;
theme_name=file->filename();
- QString theme_file=QPEApplication::qpeDir()+"/backgammon/"+theme_name+".theme";
+ QString theme_file=QPEApplication::qpeDir()+"backgammon/"+theme_name+".theme";
if(!QMessageBox::warning(this,tr( "Backgammon" ),tr( "deleted theme %1?").arg(theme_name),tr( "OK" ),tr( "Cancel" )))
{
QFile(theme_file).remove();
}
}
void BackGammon::modify_AI()
{
AI_Dialog* ai_mod=new AI_Dialog(this,tr( "Load Theme" ),".theme");
ai_mod->setAISettings(move->getAISettings());
if(!ai_mod->exec())
return;
//get the AI settings
AISettings ai=ai_mod->getAISettings();
move->setAISettings(ai);
//write new settings to conf file
Config conf("backgammon");
conf.setGroup("ai");
conf.writeEntry("rescue",ai.rescue);
conf.writeEntry("eliminate",ai.eliminate);
conf.writeEntry("expose",ai.expose);
conf.writeEntry("protect",ai.protect);