X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Fgame.php;h=9028364e93bec14ae740ba02d2e64a4d2045e8c1;hp=15f2e68f83b134aa8653414802052b30b5e20898;hb=e2db7fab7569c20afa4f7915edb70842ae1aed8e;hpb=decc97576b98d2b422fc30742b7862990dd3d057 diff --git a/include/game.php b/include/game.php index 15f2e68..9028364 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. * @@ -334,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) @@ -396,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'. @@ -518,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); @@ -571,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'); @@ -1565,7 +1577,7 @@ switch($mystatus) if($party1 != $party2) DB_query("INSERT INTO Score". - " VALUES( NULL,NULL,$gameid,'$party1',$uid1,$uid2,'fox')"); + " VALUES(NULL,CURRENT_TIMESTAMP,$gameid,'$party1',$uid1,$uid2,'fox')"); } } @@ -1590,7 +1602,7 @@ switch($mystatus) $party1 = DB_get_party_by_gameid_and_userid($gameid,$uid1); DB_query("INSERT INTO Score". - " VALUES( NULL,NULL,$gameid,'$party1',$uid1,NULL,'karlchen')"); + " VALUES( NULL,CURRENT_TIMESTAMP,$gameid,'$party1',$uid1,NULL,'karlchen')"); }; }; }; /* end scoring Karlchen */ @@ -1610,7 +1622,7 @@ switch($mystatus) $party1 = DB_get_party_by_gameid_and_userid($gameid,$uid1); DB_query("INSERT INTO Score". - " VALUES( NULL,NULL,$gameid,'$party1',$uid1,NULL,'doko')"); + " VALUES( NULL,CURRENT_TIMESTAMP,$gameid,'$party1',$uid1,NULL,'doko')"); } /* @@ -1823,14 +1835,14 @@ switch($mystatus) for( $p=$call_contra;$p<=120; $p+=30 ) { DB_query('INSERT INTO Score'. - " VALUES( NULL,NULL,$gameid,'re',NULL,NULL,'against$p')"); + " VALUES( NULL,CURRENT_TIMESTAMP,$gameid,'re',NULL,NULL,'against$p')"); } for( $p=$call_contra; $p<120; $p+=30) { if( $re >= $p ) DB_query('INSERT INTO Score'. - " VALUES( NULL,NULL,$gameid,'re',NULL,NULL,'made$p')"); + " VALUES( NULL,CURRENT_TIMESTAMP,$gameid,'re',NULL,NULL,'made$p')"); } } if($winning_party!='re' and $call_re!= -1) @@ -1838,14 +1850,14 @@ switch($mystatus) for( $p=$call_re;$p<=120; $p+=30 ) { DB_query('INSERT INTO Score'. - " VALUES( NULL,NULL,$gameid,'contra',NULL,NULL,'against$p')"); + " VALUES( NULL,CURRENT_TIMESTAMP,$gameid,'contra',NULL,NULL,'against$p')"); } for( $p=$call_re; $p<120; $p+=30) { if( $contra>=$p ) DB_query('INSERT INTO Score'. - " VALUES( NULL,NULL,$gameid,'contra',NULL,NULL,'made$p')"); + " VALUES( NULL,CURRENT_TIMESTAMP,$gameid,'contra',NULL,NULL,'made$p')"); } } @@ -1853,7 +1865,7 @@ switch($mystatus) if($winning_party=='contra') { DB_query('INSERT INTO Score'. - " VALUES( NULL,NULL,$gameid,'contra',NULL,NULL,'againstqueens')"); + " VALUES( NULL,CURRENT_TIMESTAMP,$gameid,'contra',NULL,NULL,'againstqueens')"); } /* one point each for winning and each 30 points + calls */ @@ -1867,14 +1879,14 @@ switch($mystatus) if($re>$p-$offset) DB_query('INSERT INTO Score'. - " VALUES( NULL,NULL,$gameid,'re',NULL,NULL,'".(240-$p)."')"); + " VALUES( NULL,CURRENT_TIMESTAMP,$gameid,'re',NULL,NULL,'".(240-$p)."')"); } /* re called something and won */ foreach(array(0,30,60,90,120) as $p) { if($call_re!= -1 && $call_re<$p+1) DB_query('INSERT INTO Score'. - " VALUES( NULL,NULL,$gameid,'re',NULL,NULL,'call$p')"); + " VALUES( NULL,CURRENT_TIMESTAMP,$gameid,'re',NULL,NULL,'call$p')"); } } else if( $winning_party=='contra') @@ -1887,14 +1899,14 @@ switch($mystatus) if($contra>$p-$offset) DB_query('INSERT INTO Score'. - " VALUES( NULL,NULL,$gameid,'contra',NULL,NULL,'".(240-$p)."')"); + " VALUES( NULL,CURRENT_TIMESTAMP,$gameid,'contra',NULL,NULL,'".(240-$p)."')"); } /* re called something and won */ foreach(array(0,30,60,90,120) as $p) { if($call_contra != -1 && $call_contra<$p+1) DB_query('INSERT INTO Score'. - " VALUES( NULL,NULL,$gameid,'contra',NULL,NULL,'call$p')"); + " VALUES( NULL,CURRENT_TIMESTAMP,$gameid,'contra',NULL,NULL,'call$p')"); } }; @@ -2078,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);