summaryrefslogtreecommitdiffstats
path: root/functions.php
diff options
context:
space:
mode:
authorarun <arun@nubati.net>2007-01-16 15:11:17 +0000
committerarun <arun>2007-01-16 15:11:17 +0000
commit34b2b5ea5e502686deb9f7672c92e8729157bfe5 (patch)
treef01cef92f4a038f5e508713b64f440ac8459180b /functions.php
parent8c5281010622386c1c57a8ee5eec18ed89dfb039 (diff)
downloade-DoKo-34b2b5ea5e502686deb9f7672c92e8729157bfe5.tar.gz
e-DoKo-34b2b5ea5e502686deb9f7672c92e8729157bfe5.tar.bz2
e-DoKo-34b2b5ea5e502686deb9f7672c92e8729157bfe5.zip
fixed the new sorting algorithm
Diffstat (limited to 'functions.php')
-rw-r--r--functions.php22
1 files changed, 9 insertions, 13 deletions
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