diff options
author | arun <arun@nubati.net> | 2007-01-16 15:00:03 +0000 |
---|---|---|
committer | arun <arun> | 2007-01-16 15:00:03 +0000 |
commit | 8c5281010622386c1c57a8ee5eec18ed89dfb039 (patch) | |
tree | b023c2835cdc29f4a74a3ef42e06657509fcaecd | |
parent | 651d44e67499ec7cae07c60c5351f65424c93279 (diff) | |
download | e-DoKo-8c5281010622386c1c57a8ee5eec18ed89dfb039.tar.gz e-DoKo-8c5281010622386c1c57a8ee5eec18ed89dfb039.tar.bz2 e-DoKo-8c5281010622386c1c57a8ee5eec18ed89dfb039.zip |
new sort function; should sorrt correctly for solos,etc
-rw-r--r-- | functions.php | 20 | ||||
-rw-r--r-- | index.php | 2 |
2 files changed, 21 insertions, 1 deletions
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 @@ -667,7 +667,7 @@ else if(myisset("me")) } $mycards = DB_get_hand($me); - sort($mycards); + mysort($mycards,$gametype); echo "<div class=\"mycards\">\n"; if($myturn && !myisset("card")) |