[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    playground/games/kmj/src
From:       Wolfgang Rohdewald <wolfgang () rohdewald ! de>
Date:       2010-01-19 16:57:09
Message-ID: 1263920229.770935.30045.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1077198 by wrohdewald:

safeguard against deferencing player.handBoard=None. Not sure if this is all needed

 M  +3 -1      game.py  
 M  +4 -1      playfield.py  
 M  +1 -1      scoring.py  


--- trunk/playground/games/kmj/src/game.py #1077197:1077198
@@ -495,6 +495,7 @@
         """
         self.rotated = 0
         self.players = [] # if we fail later on in init, at least we can still close \
the program +        self.activePlayer = None
         self.field = field
         self.ruleset = None
         self.winner = None
@@ -545,7 +546,8 @@
             self.client = None
         for player in self.players:
             player.clearHand()
-            player.handBoard.hide()
+            if player.handBoard:
+                player.handBoard.hide()
             player.handBoard = None
         if self.field:
             self.removeWall()
--- trunk/playground/games/kmj/src/playfield.py #1077197:1077198
@@ -201,7 +201,8 @@
     def clearHand(self):
         """clears data related to current hand"""
         self.manualRuleBoxes = []
-        self.handBoard.clear()
+        if self.handBoard:
+            self.handBoard.clear()
         Player.clearHand(self)
 
     def hasManualScore(self):
@@ -292,6 +293,8 @@
             # PlayingPlayer but not now. Just make sure that ExplainView can always \
call the  # same computeHandContent regardless of the game type
             return Player.computeHandContent(self, withTile=withTile)
+        if not self.handBoard:
+            return None
         string = ' '.join([self.handBoard.scoringString(), self.__mjString(), \
                self.__lastString()])
         mRules = list(x.rule for x in self.manualRuleBoxes if x.isChecked())
         if game.eastMJCount == 8 and self == game.winner and self.wind == 'E':
--- trunk/playground/games/kmj/src/scoring.py #1077197:1077198
@@ -716,7 +716,7 @@
         for idx, player in enumerate(self.game.players):
             self.spValues[idx].blockSignals(True) # we do not want that change to \
                call computeScores again
             self.wonBoxes[idx].blockSignals(True) # we do not want that change to \
                call computeScores again
-            if player.handBoard.allTiles():
+            if player.handBoard and player.handBoard.allTiles():
                 self.spValues[idx].setEnabled(False)
                 for loop in range(10):
                     prevTotal = player.handTotal


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic