From: arun Date: Tue, 16 Jan 2007 15:00:03 +0000 (+0000) Subject: new sort function; should sorrt correctly for solos,etc X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=commitdiff_plain;h=8c5281010622386c1c57a8ee5eec18ed89dfb039 new sort function; should sorrt correctly for solos,etc --- diff --git a/functions.php b/functions.php index 221bea8..cecc63c 100644 --- a/functions.php +++ b/functions.php @@ -523,4 +523,24 @@ 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; + } + + $compare = create_function("$a, $b", "return pos_array($a,$ALL)-pos_array($b,$ALL);"); + + usort ( $cards, $compare ); + + return; +} + + ?> \ No newline at end of file diff --git a/index.php b/index.php index f8bb305..ef047be 100644 --- a/index.php +++ b/index.php @@ -667,7 +667,7 @@ else if(myisset("me")) } $mycards = DB_get_hand($me); - sort($mycards); + mysort($mycards,$gametype); echo "
\n"; if($myturn && !myisset("card"))