diff options
author | Arun Persaud <arun@nubati.net> | 2009-01-24 17:40:46 -0800 |
---|---|---|
committer | Arun Persaud <arun@nubati.net> | 2009-01-24 17:40:46 -0800 |
commit | c7a14bb90bb3ce1a8e49b27460217a49a1fd4720 (patch) | |
tree | c63246252059238b00af32891c7a6111982964c7 /include/functions.php | |
parent | 193099c75801f128beb8f3bb9541a3cb70f24002 (diff) | |
download | e-DoKo-c7a14bb90bb3ce1a8e49b27460217a49a1fd4720.tar.gz e-DoKo-c7a14bb90bb3ce1a8e49b27460217a49a1fd4720.tar.bz2 e-DoKo-c7a14bb90bb3ce1a8e49b27460217a49a1fd4720.zip |
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.
Diffstat (limited to 'include/functions.php')
-rw-r--r-- | include/functions.php | 15 |
1 files changed, 10 insertions, 5 deletions
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 " <img src=\"pics/button/poverty_trump_button.png\" class=\"button\" alt=\"poverty < trump back\" title=\"poverty - trump back\" />"; 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 " <img src=\"pics/button/poverty_trump_button.png\" class=\"button\" alt=\"poverty < trump back\" title=\"poverty - trump back\" />"; 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 " <img src=\"pics/button/poverty2_trump_button.png\" class=\"button\" alt=\"poverty2 < trump back\" title=\"poverty2 - trump back\"/>"; else |