new sort function; should sorrt correctly for solos,etc
[e-DoKo.git] / functions.php
index e9ead78166e0c3b3031f2dee5a01d8fd02e323ac..cecc63c5df74b79598cbf5f3a1e164b6a9f416b6 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; 
@@ -364,7 +363,7 @@ function card_value($card)
     case 48:                  
       return 0;
     default:
-      echo "something went wrong, please contact the admin. ErrorCode: 2<br>";
+      echo "something went wrong, please contact the admin. ErrorCode: 2 - $card<br>";
       return 0;
     }
 }
@@ -524,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