X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Fgame.php;h=b41ca26382b2b45283622106b7b2f6a019cbc6c8;hp=dcc08c36f34dc835379116c7b4cdf63d5f06dce3;hb=f922adf616e3a3effca51f85edfdbc11eef91799;hpb=1aee459a01f55814a095bbb16f7f9b074f4fc667;ds=sidebyside diff --git a/include/game.php b/include/game.php index dcc08c3..b41ca26 100644 --- a/include/game.php +++ b/include/game.php @@ -57,18 +57,35 @@ if($gametype=="solo") $GT = $gametype." ".$GT; } -/* does anyone have both foxes */ -$GAME["schweinchen"]=0; -for($i=1;$i<5;$i++) - { - $hash = DB_get_hash_from_game_and_pos($gameid,$i); - $cards = DB_get_all_hand($hash); - if( in_array("19",$cards) && in_array("20",$cards) ) - { - $GAME["schweinchen"]=1; - $GAME["schweinchen-who"]=$hash; - } - }; +/* do we need to worry about Schweinchen? + * check gametype and rules + * if yes, figure out if someone actually has Schweinchen + * save information in $GAME + */ +$ok=0; +if( $gametype == 'normal' || $gametype == 'silent' || $gametype=='trump' ) + if( in_array($RULES['schweinchen'],array('both','second','secondaftercall')) ) + $ok=1; + +if($ok) +{ + /* need to check for Schweinchen */ + for($i=1;$i<5;$i++) + { + $hash = DB_get_hash_from_game_and_pos($gameid,$i); + $cards = DB_get_all_hand($hash); + if( in_array("19",$cards) && in_array("20",$cards) ) + $GAME['schweinchen-who']=$hash; + }; + $GAME['schweinchen-first'] = 0; /* to keep track if they have been played already */ + $GAME['schweinchen-second'] = 0; +} +else +{ + /* no need to check for Schweinchen */ + $GAME['schweinchen-who']=NULL; +} +/* end check for Schweinchen */ /* put everyting in a form */ echo "