X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Fgame.php;h=a90d8b2dea1418bfdd3be82a2461a92a7b216dc0;hp=b41ca26382b2b45283622106b7b2f6a019cbc6c8;hb=a40c1ed8a796ad846a254da83a83ae92c3184228;hpb=f922adf616e3a3effca51f85edfdbc11eef91799 diff --git a/include/game.php b/include/game.php index b41ca26..a90d8b2 100644 --- a/include/game.php +++ b/include/game.php @@ -26,6 +26,8 @@ if(!$myid) exit(); } +global $GAME,$RULES,$CARDS; + /* user might get here by clicking on the link in an email, so session might not be set */ if(isset($_SESSION["name"])) output_status($_SESSION["name"]); @@ -63,9 +65,23 @@ if($gametype=="solo") * 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( $gamestatus == 'pre' ) + { + /* always need to use Schweinchen to figure out for example who has poverty */ + $ok=1; + } +else + { + /* in a game Schweinchen is not valid in all types of games */ + if( $gametype == 'normal' || $gametype == 'silent' || $gametype=='trump' ) + if( in_array($RULES['schweinchen'],array('both','second','secondaftercall')) ) + $ok=1; + } + +/* these are the defaults */ +$GAME['schweinchen-who'] = NULL; +$GAME['schweinchen-first'] = NULL; +$GAME['schweinchen-second'] = NULL; if($ok) { @@ -80,13 +96,10 @@ if($ok) $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 */ +set_gametype($gametype); /* this sets the $CARDS variable */ + /* put everyting in a form */ echo "
\n"; @@ -202,7 +215,7 @@ switch($mystatus) case 'init': /* here we ask the player if he is sick */ $mycards = DB_get_hand($me); - sort($mycards); + $mycards = mysort($mycards,$gametype); /* output sickness of other playes, in case the already selected and are sitting in front of the current player */ echo "\n