X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Fgame.php;h=88158b991840e7b63e80223ecef6076d74c02979;hp=541c70a184a2a627a16bd684d4e78f51cc6380de;hb=742ba18eaf36386d2d0e0936975b3f2545afc59e;hpb=d3841fcbcb98f5e2bbdeb7b89733b8757e848f20 diff --git a/include/game.php b/include/game.php index 541c70a..88158b9 100644 --- a/include/game.php +++ b/include/game.php @@ -1,5 +1,5 @@ +/* Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014 Arun Persaud * * This file is part of e-DoKo. * @@ -46,6 +46,7 @@ global $GAME,$RULES,$CARDS; /************************************** * get some information from the DB **************************************/ +start: $gameid = DB_get_gameid_by_hash($me); $myname = DB_get_name('hash',$me); $mystatus = DB_get_status_by_hash($me); @@ -333,7 +334,7 @@ if($session) echo ' '._('Game')." $session.$j"; if($gamestatus != 'pre') if($gametype_raw != 'normal') /* only show when needed */ - if(!($gametype_raw == 'solo' && $gametyep_solo == 'silent') ) + if(!($gametype_raw == 'solo' && $gametype_solo == 'silent') ) echo " ($GT)"; if(isset($_SESSION['id']) && $_SESSION['id']==$myid) @@ -395,7 +396,7 @@ switch($mystatus) /* output vorbehalte */ if($gametype_raw != 'normal') /* only show when needed */ - if(!($gametype_raw == 'solo' && $gametyep_solo == 'silent') ) + if(!($gametype_raw == 'solo' && $gametype_solo == 'silent') ) echo "
  • Pre
  • \n"; $result = DB_query('SELECT Trick.id'. @@ -517,6 +518,7 @@ switch($mystatus) */ DB_set_hand_status_by_hash($me,'init'); + $mystatus='init'; /* check if everyone has reached this stage, set player in game-table to the next player */ $userids = DB_get_all_userid_by_gameid($gameid); @@ -561,9 +563,7 @@ switch($mystatus) break; } else - { - /* everything is ok, save what user said and proceed */ - $messages[] = _('Processing what you selected in the last step...'); + { /* everything is ok, save what user said and proceed */ /* check if this sickness needs to be handled first */ $startplayer = DB_get_startplayer_by_gameid($gameid); /* need this to check which solo goes first */ @@ -572,6 +572,17 @@ switch($mystatus) { /* user wants to play a solo */ + /* double check input value */ + $s = $_REQUEST['solo']; + $solos = array('trumpless','jack','queen','trump','club','spade','heart'); + if (!in_array($s, $solos)) + { + $messages[] = sprintf(_('There is a problem with the type of solo you selected (%s does not exist), please go back '. + 'and answer the question again.'), + $s,$INDEX.'?action=game&me=$me&in=yes'); + break; + } + /* store the info in the user's hand info */ DB_set_solo_by_hash($me,$_REQUEST['solo']); DB_set_sickness_by_hash($me,'solo'); @@ -634,8 +645,6 @@ switch($mystatus) * this can therefore only be handled once all players finished the last stage */ - $messages[] = _('Checking if someone else selected solo, nines, wedding or poverty.'); - /* check if everyone has reached this stage */ $userids = DB_get_all_userid_by_gameid($gameid); $ok = 1; @@ -663,10 +672,8 @@ switch($mystatus) * are playing, in case there are any solos this already * will have the correct information in it */ - $messages[] = _('Ok, everyone is done... figuring out what kind of game we are playing.'); - /* gametype for displaying it (hides hidden solo)*/ - $GT = get_display_gametype($gameid); + $GT = get_display_gametype($gameid); $startplayer = DB_get_startplayer_by_gameid($gameid); @@ -791,7 +798,6 @@ switch($mystatus) $gametype = 'wedding'; }; /* now the gametype is set correctly in the database */ - $messages[] = _('Got it').' :)'; /* loop over all players, set re/contra if possible and start the game if possible */ $userids = DB_get_all_userid_by_gameid($gameid); @@ -889,8 +895,10 @@ switch($mystatus) } } else - $messages[] = sprintf(_('Please, start the game.'),$INDEX."?action=game&me=$me"). - "
    \n"; + { + $mystatus = 'play'; + goto play; + } } else { @@ -900,8 +908,10 @@ switch($mystatus) $whoid = DB_get_userid('gameid-position',$gameid,$who); if($whoid==$myid) - $messages[] = sprintf(_('Please, start the game.'),$INDEX."?action=game&me=$me"). - "
    take trump, @@ -991,7 +1002,10 @@ switch($mystatus) } } else - $messages[]= sprintf(_('Please, start the game.'),$INDEX."?action=game&me=$me"); + { + $mystatus = 'play'; + goto play; + } } /* the following is part A) of what needs to be done */ @@ -1196,6 +1210,7 @@ switch($mystatus) case 'play': case 'gameover': + play: /* both entries here, so that the tricks are visible for both. * in case of 'play' there is a break later that skips the last part */ @@ -2075,17 +2090,21 @@ switch($mystatus) * this outputs status of healthy, * * sick, etc during pre-game phase * **********************************/ + +$posmax=5; // if user is still in init, we only show vorbehalte from players before him, otherwise all of them + switch($mystatus) { case 'start': break; case 'init': + $posmax=$mypos; case 'check': /* output sickness of other playes, in case they already selected and are sitting in front of the current player */ echo "\n".'
    '."\n"; echo '
    '."\n"; - for($pos=1;$pos<5;$pos++) + for($pos=1;$pos<$posmax;$pos++) { $usersick = DB_get_sickness_by_pos_and_gameid($pos,$gameid); $userid = DB_get_userid('gameid-position',$gameid,$pos);