LAYOUT: added user menu to newgame page also when you started a game
[e-DoKo.git] / include / game.php
index bbaa5b3500a2e945c5d4a2b113806b0cdb4f2d40..7905acd63a00a9d1e5ae7619711e5a0d520e85a7 100644 (file)
@@ -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"]);
@@ -76,6 +78,11 @@ else
        $ok=1;
   }
 
+/* these are the defaults */
+$GAME['schweinchen-who']    = NULL;
+$GAME['schweinchen-first']  = NULL;
+$GAME['schweinchen-second'] = NULL;
+
 if($ok)
 {
   /* need to check for Schweinchen */
@@ -89,14 +96,13 @@ 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 */
+/* set the $CARDS variable, needed for sorting the cards
+ * we set it to normal so that the pre-game phase is handled ok
+ * and later set it to the correct game type that is played
+ */
+set_gametype('normal');
 
 /* put everyting in a form */
 echo "<form action=\"index.php?action=game&me=$me\" method=\"post\">\n";