[Kde-games-devel] A patch for kreversi (bis)

Albert Astals Cid tsdgeos at terra.es
Fri Apr 25 09:53:59 CEST 2003


I sned again the patch as this -> is not necessary in the isVisible() 
modification

? kreversi_diff
Index: board.cpp
===================================================================
RCS file: /home/kde/kdegames/kreversi/board.cpp,v
retrieving revision 1.25
diff -u -r1.25 board.cpp
--- board.cpp	17 Apr 2003 04:37:39 -0000	1.25
+++ board.cpp	24 Apr 2003 22:22:36 -0000
@@ -347,7 +347,10 @@
     Move m = engine->ComputeMove(*game);
     setState(HINT);
     if(m.GetX() != -1) {
-      for(int flash = 0; (flash < 100) && (getState() != READY); flash++) {
+      // the isVisible condition has been added so that when the player was 
viewing
+      // a hint and quits the game window, the game must not still do all 
this looping
+      // and directly ends
+      for(int flash = 0; (flash < 100) && (getState() != READY) && 
isVisible(); flash++) {
 	if(flash & 1)
 	  drawOnePiece(m.GetY() - 1, m.GetX() - 1, Score::NOBODY);
 	else
Index: kreversi.cpp
===================================================================
RCS file: /home/kde/kdegames/kreversi/kreversi.cpp,v
retrieving revision 1.4
diff -u -r1.4 kreversi.cpp
--- kreversi.cpp	17 Apr 2003 04:37:41 -0000	1.4
+++ kreversi.cpp	24 Apr 2003 22:22:37 -0000
@@ -189,24 +189,6 @@
     zoomOutAction->setEnabled(false);
 }

-void KReversi::processEvent(int itemid) {
-#ifdef HAVE_MEDIATOOL
-    if(!audioOK()) {
-      initAudio();
-      if(!audioOK()) {
-	KMessageBox::error(this,
-			   i18n("A problem with the sound server occured!\n"
-				"Cannot enable sound support."));
-	kapp->config()->writeEntry("Sound", 0);
-      } else
-	kapp->config()->writeEntry("Sound", 1);
-    } else {
-      doneAudio();
-      kapp->config()->writeEntry("Sound", 0);
-    }
-#endif
-}
-
 void KReversi::slotScore() {
   int black, white;
   QString s1, s2;
@@ -308,8 +290,8 @@
   statusBar()->changeItem(s, SB_TURN);
 }

-void KReversi::slotStatusChange(int) {
-  if(board->getState() == Board::THINKING){
+void KReversi::slotStatusChange(int status) {
+  if(status == Board::THINKING){
     kapp->setOverrideCursor(waitCursor);
     stopAction->setEnabled(true);
   }
Index: kreversi.h
===================================================================
RCS file: /home/kde/kdegames/kreversi/kreversi.h,v
retrieving revision 1.2
diff -u -r1.2 kreversi.h
--- kreversi.h	17 Apr 2003 04:37:41 -0000	1.2
+++ kreversi.h	24 Apr 2003 22:22:37 -0000
@@ -60,7 +60,6 @@
   virtual void readProperties(KConfig *);
 
 private slots:
-  void processEvent(int itemid);
   void slotScore();
   void slotGameEnded(int);
   void slotTurn(int);



More information about the kde-games-devel mailing list