From: arun Date: Sat, 25 Nov 2006 12:41:12 +0000 (+0000) Subject: cleaned up a bit, added comments and fixed a few small bugs on the way X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=commitdiff_plain;h=8536c1e008f33b07bd3e0a9bbb0feb98043cb021;ds=sidebyside cleaned up a bit, added comments and fixed a few small bugs on the way --- diff --git a/index.php b/index.php index de9d382..a7af6df 100644 --- a/index.php +++ b/index.php @@ -8,8 +8,10 @@ +

Welcome to E-Doko

If you find bugs, please list them in the wiki.

\n"; echo "

Names that are underlined have a comment, which you can access by hovering over the name with your mouse ;)

\n"; +echo "
\n"; + +/* end header */ + $history=array(); @@ -402,8 +411,8 @@ $history=array(); if(file_exists("status.txt")) $lines = file("status.txt"); - else - die("no file"); +else + die("no file"); /* check if we want to start a new game */ if( isset($_REQUEST["PlayerA"]) && @@ -517,9 +526,9 @@ if(sizeof($lines)<2)
Do you want to play a game of DoKo? @@ -555,7 +562,6 @@ if(sizeof($lines)<2) echo "
\n"; } } - /* *** * * * * *** @@ -565,56 +571,59 @@ if(sizeof($lines)<2) */ if(isset($_REQUEST["b"])) { - $b=$_REQUEST["b"]; + $b = $_REQUEST["b"]; if( ereg("s",$player[$b]["option"]) && $game["init"]<4) - { + { /* the player already filled out everything */ echo "just wait for the game to start"; } else if( (!isset($_REQUEST["in"])|| !isset($_REQUEST["update"])) && !ereg("i",$player[$b]["option"])) - { + { /* the player didn't fill out the form at "a" correctly */ echo "go back to "; echo " here and fill out the form
\n"; } else - { /* show the hand */ + { /* show the hand and check if the player is sick*/ if($_REQUEST["in"]=="no") - { + { /* player doesn't want to play, cancel the game */ for($i=0;$i<4;$i++) { $message = "Hello ".$player[$hash[$i]]["name"].",\n\n". "the game has been canceled due to the request of one of the players.\n"; mymail($player[$hash[$i]]["email"],"[DoKo-Debug] the game has been canceled",$message); } - $output = fopen("status.txt","w"); - if($output) - fclose($output); - else - echo "problem opening file"; + /* canceling the game is as easy as removing the contents of the status file*/ + $output = fopen("status.txt","w"); + if($output) + fclose($output); + else + echo "problem opening file"; } else { - if($_REQUEST["update"]=="card") $player[$b]["option"].="c"; - if($_REQUEST["update"]=="turn") $player[$b]["option"].="t"; + /* player wants to play, save information from "a"*/ + if($_REQUEST["update"]=="card") + $player[$b]["option"] .= "c"; + else + $player[$b]["option"] .= "t"; - $player[$b]["option"].="i"; + $player[$b]["option"] .= "i"; /* player finished stage "a" */ save_status(); $allcards = $player[$b]["cards"]; - $mycards = explode(";",$allcards); + $mycards = explode(";",$allcards); sort($mycards); - echo "your cards are
\n"; + echo "

your cards are:
\n"; foreach($mycards as $card) - { - display_card($card); - } - echo "
\n"; + display_card($card); + echo "

\n"; ?> -

aehm... at the moment poverty is not implented. so I guess you need to play a normal game, even if you have less than 3 turmp :(...sorry

+

aehm... at the moment poverty is not implented. so I guess you need to play a normal game, even if you have less than 3 trump :(...sorry

+
- + do you want to play solo?