X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=functions.php;h=45416a786c9a5d00317c6c861d8213704847a96c;hp=cecc63c5df74b79598cbf5f3a1e164b6a9f416b6;hb=fb8907b3f2daf368222f514d5ff36a059e330a0d;hpb=8c5281010622386c1c57a8ee5eec18ed89dfb039 diff --git a/functions.php b/functions.php index cecc63c..45416a7 100644 --- a/functions.php +++ b/functions.php @@ -525,22 +525,18 @@ function set_gametype($gametype) function mysort($cards,$gametype) { - global $TRUMP,$DIAMONDS,$HEARTS,$CLUBS,$SPADES; - - switch($gametype) { - case normal: - case trump: - default: - $ALL = array_merge($TRUMP,$DIAMONDS,$CLUBS,$HEARTS,$SPADES,$DIAMONDS); - break; - } + usort ( $cards, "sort_comp" ); + return $cards; +} - $compare = create_function("$a, $b", "return pos_array($a,$ALL)-pos_array($b,$ALL);"); +function sort_comp($a,$b) +{ + global $TRUMP,$DIAMONDS,$HEARTS,$CLUBS,$SPADES; - usort ( $cards, $compare ); + $ALL = array(); + $ALL = array_merge($TRUMP,$DIAMONDS,$CLUBS,$HEARTS,$SPADES,$DIAMONDS); - return; + return pos_array($a,$ALL)-pos_array($b,$ALL); } - ?> \ No newline at end of file