From: Arun Persaud Date: Sun, 25 Jan 2009 01:40:46 +0000 (-0800) Subject: BUGFIX: when a fox was given back in poverty a no-trump icon was shown at the table X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=commitdiff_plain;h=c7a14bb90bb3ce1a8e49b27460217a49a1fd4720;ds=sidebyside BUGFIX: when a fox was given back in poverty a no-trump icon was shown at the table used the same function to count the number of trump cards as was used to determine poverty status. Therefore, foxes were not accounted for. Fixed now. --- diff --git a/include/functions.php b/include/functions.php index 9103c6f..044c6c7 100644 --- a/include/functions.php +++ b/include/functions.php @@ -329,17 +329,22 @@ function check_wedding($cards) return 0; } -function count_trump($cards) +function count_trump($cards,$status='pregame') { global $RULES; $trump = 0; - /* count each trump, including the foxes */ + /* count each trump, including the foxes, since this is used to determine poverty status */ foreach($cards as $c) if( (int)($c) <27) $trump++; + /* In case we really want to know the amount of trump, we can use the status variable. + * This is needed for example to figure out what icon to display on the table in case of + * trump given back in poverty */ + if($status=='all') return $trump; + /* normally foxes don't count as trump, so we substract them here * in case someone has schweinchen, one or two of them should count as trump * though, so we need to add one trump for those cases */ @@ -777,7 +782,7 @@ function display_table () { $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); $cards = DB_get_all_hand($userhash); - $trumpNR = count_trump($cards); + $trumpNR = count_trump($cards,'all'); if($trumpNR) echo " \"poverty"; else @@ -792,7 +797,7 @@ function display_table () { $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); $cards = DB_get_all_hand($userhash); - $trumpNR = count_trump($cards); + $trumpNR = count_trump($cards,'all'); if($trumpNR) echo " \"poverty"; else @@ -805,7 +810,7 @@ function display_table () { $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); $cards = DB_get_all_hand($userhash); - $trumpNR = count_trump($cards); + $trumpNR = count_trump($cards,'all'); if($trumpNR) echo " \"poverty2"; else