BUGFIX: when playing with both schweinchen
authorArun Persaud <arun@nubati.net>
Mon, 29 Oct 2007 19:29:42 +0000 (20:29 +0100)
committerArun Persaud <arun@nubati.net>
Mon, 29 Oct 2007 19:29:42 +0000 (20:29 +0100)
they second fox always became the highest trump, even if the two
foxes where not on the same hand.
Also: every fox led to a comment:"schweinchen".
Both fixed now.

index.php

index 538bc81938f9eebcc76b0d203d0b30d7d4527892..7d35814cb400c13a4284c911e7e5962f07409bb2 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1120,7 +1120,7 @@ else if(myisset("me"))
          date_default_timezone_set($zone);
 
          /* check if first schweinchen has been played */
          date_default_timezone_set($zone);
 
          /* check if first schweinchen has been played */
-         if($r[0] == 19 || $r[0] == 20 )
+         if( $GAME["schweinchen"] && ($r[0] == 19 || $r[0] == 20) )
            $GAME["schweinchen"]++;
          
          /* save card to be able to find the winner of the trick later */
            $GAME["schweinchen"]++;
          
          /* save card to be able to find the winner of the trick later */
@@ -1230,9 +1230,9 @@ else if(myisset("me"))
              $playid = DB_play_card($trickid,$handcardid,$sequence);
 
              /* check for schweinchen */
              $playid = DB_play_card($trickid,$handcardid,$sequence);
 
              /* check for schweinchen */
-             if($card == 19 || $card == 20 )
+             if($GAME["schweinchen"] && ($card == 19 || $card == 20) )
                {
                {
-                 $GAME["schweinchen"]++;
+                 $GAME["schweinchen"]++; // count how many have been played including this one
                  if($GAME["schweinchen"]==3 && $RULES["schweinchen"]=="second" )
                    DB_insert_comment("Schweinchen! ",$playid,$myid);
                  if($RULES["schweinchen"]=="both" )
                  if($GAME["schweinchen"]==3 && $RULES["schweinchen"]=="second" )
                    DB_insert_comment("Schweinchen! ",$playid,$myid);
                  if($RULES["schweinchen"]=="both" )