X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Fgame.php;h=3a015662f50a437f0f87f9231b08d62199199a83;hp=4dbf68f0a6e291dd194c485d8844a4c8aa49bc2b;hb=6437c15bdaac379a15d7e6392122f027d8254ec6;hpb=c956a58882bbfef255af6817d8f21432968ac785 diff --git a/include/game.php b/include/game.php index 4dbf68f..3a01566 100644 --- a/include/game.php +++ b/include/game.php @@ -105,25 +105,35 @@ if($ok) set_gametype('normal'); /* put everyting in a form */ -echo "
\n"; +echo "\n"; /* output game */ /* output extra division in case this game is part of a session */ if($session) { - echo "
\n". - "This game is part of session $session: \n"; + echo "
\n"; + echo "
Rules (+icons fur rules) \n"; + echo "
\n"; + echo " 10ofhearts : ".$RULES["dullen"] ."
\n"; + echo " schweinchen: ".$RULES["schweinchen"] ."
\n"; + echo " call: ".$RULES["call"] ."
\n"; + echo "
\n
\n"; + echo "
Score \n"; + $score = generate_score_table($session); + echo format_score_table_html($score,$myid); + echo "
\n"; $hashes = DB_get_hashes_by_session($session,$myid); $i = 1; foreach($hashes as $hash) { - if($hash == $me) - echo "$i \n"; - else - echo "$i \n"; - $i++; + if($hash == $me) + $j=$i; + $i++; + $lasthash=$hash; } + $i--; + echo "This is game number $j of $i in session $session."; echo "
\n"; } @@ -142,7 +152,11 @@ display_table(); switch($mystatus) { case 'start': - if( !myisset("in") ) + /* don't ask if user has autosetup set to yest */ + $skip = 0; + if($PREF['autosetup']=='yes') $skip = 1; + + if( !myisset("in") && !$skip) { /* asks the player, if he wants to join the game */ output_check_want_to_play($me); @@ -151,7 +165,7 @@ switch($mystatus) else { /* check the result, if player wants to join, got next stage, else cancel game */ - if($_REQUEST["in"] == "no") + if(!$skip && $_REQUEST["in"] == "no" ) { /* cancel the game */ $message = "Hello, \n\n". @@ -268,7 +282,7 @@ switch($mystatus) if($Nsickness>1) { echo "

You selected more than one sickness, please go back ". - "and answer the question again.

"; + "and answer the question again.

"; echo "
Your cards are:
\n"; foreach($mycards as $card) @@ -606,7 +620,7 @@ switch($mystatus) } } else - echo " Please, start the game.
\n"; + echo " Please, start the game.
\n"; } else { @@ -616,7 +630,7 @@ switch($mystatus) $whoid = DB_get_userid('gameid-position',$gameid,$who); if($whoid==$myid) - echo " Please, start the game.
\n"; + echo " Please, start the game.
\n"; else { $email = DB_get_email('position-gameid',$who,$gameid); @@ -714,7 +728,7 @@ switch($mystatus) } } else - echo " Please, start the game.
\n"; + echo " Please, start the game.
\n"; } /* the following is part A) of what needs to be done */ @@ -740,10 +754,10 @@ switch($mystatus) foreach($cards as $card) if($card<27) $nrtrump++; echo "Player $name has $nrtrump trump. Do you want to take them?". - "yes
\n"; + "Yes
\n"; } } - echo "No,way I take those trump...
\n"; + echo "No way
\n"; echo "
\n"; echo "
Your cards are:
\n"; @@ -812,7 +826,7 @@ switch($mystatus) DB_set_hand_status_by_hash($userhash,'poverty'); $message = "Someone has poverty, it's your turn to decide, if you want to take the trump. Please visit:". - " ".$HOST.$INDEX."?action=game&me=".$userhash."\n\n" ; + " ".$HOST.$INDEX."?action=game&me=".$userhash."\n\n" ; mymail($To,$EmailName." poverty (game ".DB_format_gameid($gameid).")",$message); } } @@ -904,7 +918,7 @@ switch($mystatus) } } - echo "
Please, continue here.
\n"; + echo "
Please, continue here.
\n"; } } echo "
"; @@ -1041,7 +1055,7 @@ switch($mystatus) "WHERE Trick.game_id='".$gameid."' ". "GROUP BY Trick.id, sequence ". "ORDER BY Trick.id, sequence ASC"); - $trickNR = 1; + $trickNR = 0; $lasttrick = DB_get_max_trickid($gameid); $play = array(); /* needed to calculate winner later */ @@ -1057,7 +1071,7 @@ switch($mystatus) if($mygametype != 'normal' && $mygametype != 'silent') /* only show when needed */ { echo "
  • Pre\n". - "
    \n"; + "
    \n"; $show = 1; for($mypos=1;$mypos<5;$mypos++) { @@ -1085,6 +1099,10 @@ switch($mystatus) $comment = $r[4]; $user = $r[6]; + /* count number of tricks */ + if($seq==1) + $trickNR++; + /* check if first schweinchen has been played */ if( $GAME['schweinchen-who'] && ($r[0] == 19 || $r[0] == 20) ) if(!$GAME['schweinchen-first']) @@ -1132,7 +1150,6 @@ switch($mystatus) /* end of trick? */ if($seq==4) { - $trickNR++; echo "
    \n
  • \n"; /* end div trick, end li trick */ } } @@ -1642,35 +1659,9 @@ switch($mystatus) $session = DB_get_session_by_gameid($gameid); $score = generate_score_table($session); - /* convert html to ascii */ - $score = str_replace("
    \n\n \n","",$score); - $score = str_replace("
    \n","",$score); - $score = str_replace("\n","",$score); - $score = str_replace(array("","","",""),array("","\n","","|"),$score); - $score = explode("\n",$score); - - $header = array_slice($score,0,1); - $header = explode("|",$header[0]); - for($i=0;$i5) $header.= " ... \n"; - - if(sizeof($score)>5) $score = array_slice($score,-5,5); - for($i=0;$i\n"; } - if($seq!=4 && $trickNR>1) + if($seq!=4 && $trickNR>=1) echo "
    \n \n"; /* end div trick, end li trick */ /* display points in case game is over */ @@ -1731,14 +1722,15 @@ switch($mystatus) echo "
    \n \n"; /* end div trick, end li trick */ } - + echo "
  • prev
  • \n"; + echo "
  • next
  • \n"; echo "\n"; /* end ul tricks*/ echo "
    Personal notes:
    \n"; $notes = DB_get_notes_by_userid_and_gameid($myid,$gameid); foreach($notes as $note) - echo "$note
    \n"; - echo "Insert note:\n"; + echo "$note
    \n"; + echo "\n"; echo "
    \n"; $mycards = DB_get_hand($me); @@ -1861,15 +1853,6 @@ switch($mystatus) /* display rule set for this game */ echo "
    \n"; - if($gamestatus != 'pre') - echo " Gametype: $GT
    \n"; - - echo "Rules:
    \n"; - echo "10ofhearts : ".$RULES["dullen"] ."
    \n"; - echo "schweinchen: ".$RULES["schweinchen"] ."
    \n"; - echo "call: ".$RULES["call"] ."
    \n"; - - echo "
    \n"; if($gamestatus == 'play' ) output_form_calls($me); @@ -1880,15 +1863,9 @@ switch($mystatus) if($gamestatus == 'play' || $gameend < 60*60*24*7) { echo "
    \nA short comment:\n"; - echo "
    "; } - echo "\n
    \n"; - - $session = DB_get_session_by_gameid($gameid); - $score = generate_score_table($session); - - echo $score; + echo "\n"; echo "
    \n";