only ask for a new game in a session, if it was the latest game
[e-DoKo.git] / functions.php
index e4f7c60a141bb49f0d79f5ce6b4d0f5d22c5f3aa..45416a786c9a5d00317c6c861d8213704847a96c 100644 (file)
@@ -26,8 +26,8 @@ function myisset()
   foreach($args as $arg)
     {
       $ok = $ok * isset($_REQUEST[$arg]);
-      /* echo "$arg: ok = $ok <br />";
-       */
+      /*echo "$arg: ok = $ok <br />";
+       */ 
     }
   return $ok;
 }
@@ -156,7 +156,6 @@ function get_winner($p,$mode)
   $c3 = $p[3];
   $c4 = $p[4];
 
-
   /* first card is better than all the rest */
   if( compare_cards($c1,$c2,$mode) && compare_cards($c1,$c3,$mode) && compare_cards($c1,$c4,$mode) )
     return 1; 
@@ -524,4 +523,20 @@ function set_gametype($gametype)
     }
 }
 
+function mysort($cards,$gametype)
+{
+  usort ( $cards, "sort_comp" );
+  return $cards;
+}
+
+function sort_comp($a,$b)
+{
+  global $TRUMP,$DIAMONDS,$HEARTS,$CLUBS,$SPADES;
+
+  $ALL = array();
+  $ALL = array_merge($TRUMP,$DIAMONDS,$CLUBS,$HEARTS,$SPADES,$DIAMONDS);
+
+  return pos_array($a,$ALL)-pos_array($b,$ALL);
+}
+
 ?>
\ No newline at end of file