[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdegames/kjumpingcube
From: Albert Astals Cid <tsdgeos () terra ! es>
Date: 2005-03-19 12:51:59
Message-ID: 20050319125159.C60751763F () office ! kde ! org
[Download RAW message or body]
CVS commit by aacid:
Be more careful when changing computer playing side.
Fixes 88355
James can you please try CVS HEAD version and tell me if it really fixes the problem? \
I cannot reproduce it with my changes but maybe i am missing something. If you answer \
saying it is ok i'll backport for KDE 3.4.1
M +12 -7 kcubeboxwidget.cpp 1.15
M +1 -1 kcubeboxwidget.h 1.10
M +1 -1 kcubewidget.cpp 1.9
M +1 -1 kcubewidget.h 1.4
--- kdegames/kjumpingcube/kcubeboxwidget.cpp #1.14:1.15
@@ -96,4 +96,5 @@ void KCubeBoxWidget::loadSettings(){
setComputerplayer(KCubeBoxWidget::One, Prefs::computerPlayer1());
setComputerplayer(KCubeBoxWidget::Two, Prefs::computerPlayer2());
+ checkComputerplayer(currentPlayer);
}
@@ -224,6 +225,4 @@ void KCubeBoxWidget::setComputerplayer(P
else if(player==Two)
computerPlTwo=flag;
-
- checkComputerplayer(player);
}
@@ -333,10 +332,16 @@ void KCubeBoxWidget::stopHint()
}
-bool KCubeBoxWidget::checkClick(int row,int column)
+bool KCubeBoxWidget::checkClick(int row,int column, bool isClick)
{
if(isActive())
return false;
- if((Cube::Owner)currentPlayer==cubes[row][column]->owner() ||
+ // make the game start when computer player is player one and user clicks
+ if(isClick && currentPlayer == One && computerPlOne)
+ {
+ checkComputerplayer(currentPlayer);
+ return false;
+ }
+ else if((Cube::Owner)currentPlayer==cubes[row][column]->owner() ||
cubes[row][column]->owner()==Cube::Nobody)
{
@@ -368,5 +373,5 @@ void KCubeBoxWidget::checkComputerplayer
cubes[row][column]->showHint(500,2);
- bool result=checkClick(row,column);
+ bool result=checkClick(row,column,false);
assert(result);
}
@@ -472,6 +477,6 @@ void KCubeBoxWidget::initCubes()
layout->addWidget(cubes[i][j],i,j);
cubes[i][j]->show();
- connect(cubes[i][j],SIGNAL(clicked(int,int)),SLOT(stopHint()));
- connect(cubes[i][j],SIGNAL(clicked(int,int)),SLOT(checkClick(int,int)));
+ connect(cubes[i][j],SIGNAL(clicked(int,int,bool)),SLOT(stopHint()));
+ connect(cubes[i][j],SIGNAL(clicked(int,int,bool)),SLOT(checkClick(int,int,bool)));
}
--- kdegames/kjumpingcube/kcubeboxwidget.h #1.9:1.10
@@ -178,5 +178,5 @@ private slots:
* if true, it increases this cube and checks the playingfield
*/
- bool checkClick(int row,int column);
+ bool checkClick(int row,int column,bool isClick);
/** turns off blinking, if an other cube is clicked */
--- kdegames/kjumpingcube/kcubewidget.cpp #1.8:1.9
@@ -244,5 +244,5 @@ void KCubeWidget::mouseReleaseEvent(QMou
{
stopHint();
- emit clicked(row(),column());
+ emit clicked(row(),column(),true);
}
}
--- kdegames/kjumpingcube/kcubewidget.h #1.3:1.4
@@ -85,5 +85,5 @@ public slots:
signals:
- void clicked(int row,int column);
+ void clicked(int row,int column,bool isClick);
protected:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic