summaryrefslogtreecommitdiffstats
path: root/include/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'include/functions.php')
-rw-r--r--include/functions.php26
1 files changed, 22 insertions, 4 deletions
diff --git a/include/functions.php b/include/functions.php
index 5c23958..466b4ae 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -608,21 +608,39 @@ function set_gametype($gametype)
function mysort($cards,$gametype)
{
- usort ( $cards, "sort_comp" );
+ global $PREF;
+ if(isset($PREF['sorting']))
+ if($PREF['sorting']=='high-low')
+ usort ( $cards, 'sort_comp_high_low' );
+ else
+ usort ( $cards, 'sort_comp_low_high' );
+ else
+ usort ( $cards, 'sort_comp_high_low' );
return $cards;
}
-function sort_comp($a,$b)
+function sort_comp_high_low($a,$b)
{
global $CARDS;
$ALL = array();
- $ALL = array_merge($CARDS["trump"],$CARDS["diamonds"],$CARDS["clubs"],
- $CARDS["hearts"],$CARDS["spades"]);
+ $ALL = array_merge($CARDS['trump'],$CARDS['diamonds'],$CARDS['clubs'],
+ $CARDS['hearts'],$CARDS['spades']);
return pos_array($a,$ALL)-pos_array($b,$ALL);
}
+function sort_comp_low_high($a,$b)
+{
+ global $CARDS;
+
+ $ALL = array();
+ $ALL = array_merge($CARDS['trump'],$CARDS['diamonds'],$CARDS['clubs'],
+ $CARDS['hearts'],$CARDS['spades']);
+
+ return -pos_array($a,$ALL)+pos_array($b,$ALL);
+}
+
function can_call($what,$hash)
{
global $RULES;