summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorArun Persaud <arun@nubati.net>2009-01-17 20:39:05 -0800
committerArun Persaud <arun@nubati.net>2009-01-17 20:39:05 -0800
commit98959130e1ed875f0b4d783a5a82b144d504c1d4 (patch)
treee0dd26b1b880653cc41165021285db7bb93ef42f /include
parent26aa6987c5da1f102e81c4625ed8e7b116c7590b (diff)
downloade-DoKo-98959130e1ed875f0b4d783a5a82b144d504c1d4.tar.gz
e-DoKo-98959130e1ed875f0b4d783a5a82b144d504c1d4.tar.bz2
e-DoKo-98959130e1ed875f0b4d783a5a82b144d504c1d4.zip
NEW FEATURE: show when a call was made
every time a call is made (e.g. re/contra) a comment is added. So players can check when the call was made later Fixes issue #12.
Diffstat (limited to 'include')
-rw-r--r--include/game.php47
1 files changed, 41 insertions, 6 deletions
diff --git a/include/game.php b/include/game.php
index 086a2f9..b08f36b 100644
--- a/include/game.php
+++ b/include/game.php
@@ -34,6 +34,7 @@ $myname = DB_get_name('hash',$me);
$mystatus = DB_get_status_by_hash($me);
$mypos = DB_get_pos_by_hash($me);
$myhand = DB_get_handid('hash',$me);
+$myparty = DB_get_party_by_hash($me);
$session = DB_get_session_by_gameid($gameid);
/* get prefs and save them in a variable*/
@@ -119,17 +120,50 @@ if( $mystatus != 'gameover' ||
$myid == $_SESSION['id']))
output_user_notes($myid,$gameid,$mystatus);
-/* handle calls */
+/* handle calls, output a comment to show when the call was made */
+/* initialize comments */
+$comment = '';
+
+/* check for calls, set comment */
if(myisset('call') && $_REQUEST['call'] == '120' && can_call(120,$me))
- $result = DB_query("UPDATE Hand SET point_call='120' WHERE hash='$me' ");
+ {
+ $result = DB_query("UPDATE Hand SET point_call='120' WHERE hash='$me' ");
+ if($myparty=='re')
+ $comment .= "Re";
+ else if($myparty=='contra')
+ $comment .= "Contra";
+ }
if(myisset('call') && $_REQUEST['call'] == '90' && can_call(90,$me))
- $result = DB_query("UPDATE Hand SET point_call='90' WHERE hash='$me' ");
+ {
+ $result = DB_query("UPDATE Hand SET point_call='90' WHERE hash='$me' ");
+ $comment .= "No 90";
+ }
if(myisset('call') && $_REQUEST['call'] == '60' && can_call(60,$me))
- $result = DB_query("UPDATE Hand SET point_call='60' WHERE hash='$me' ");
+ {
+ $result = DB_query("UPDATE Hand SET point_call='60' WHERE hash='$me' ");
+ $comment .= "No 60";
+ }
if(myisset('call') && $_REQUEST['call'] == '30' && can_call(30,$me))
- $result = DB_query("UPDATE Hand SET point_call='30' WHERE hash='$me' ");
+ {
+ $result = DB_query("UPDATE Hand SET point_call='30' WHERE hash='$me' ");
+ $comment .= "No 30";
+ }
if(myisset('call') && $_REQUEST['call'] == '0' && can_call(0,$me))
- $result = DB_query("UPDATE Hand SET point_call='0' WHERE hash='$me' ");
+ {
+ $result = DB_query("UPDATE Hand SET point_call='0' WHERE hash='$me' ");
+ $comment .= "Zero";
+ }
+
+/* get information needed to submit comment */
+$playid = DB_get_current_playid($gameid);
+
+/* set comment */
+if($comment != '')
+ DB_insert_comment($comment,$playid,$myid);
+/* clear up */
+unset($comment);
+/* end check for calls */
+
/* output extra division in case this game is part of a session */
if($session)
@@ -1099,6 +1133,7 @@ switch($mystatus)
* only play a card after everyone is ready to play */
}
+
/* get time from the last action of the game */
$r = DB_query_array("SELECT mod_date from Game WHERE id='$gameid' " );
$gameend = time() - strtotime($r[0]);