BUGFIX: if a call is made the icon will show up right away
[e-DoKo.git] / include / game.php
index 3a015662f50a437f0f87f9231b08d62199199a83..0350d9e4adf2287889960674f3cea520c78808c5 100644 (file)
@@ -107,7 +107,28 @@ set_gametype('normal');
 /* put everyting in a form */
 echo "<form action=\"index.php?action=game&amp;me=$me\" method=\"post\">\n";
 
-/* output game */
+/* handle user notes (only possible while game is running)*/
+if( $mystatus!='gameover'  )
+  if(myisset("note"))
+{
+  $note = $_REQUEST['note'];
+  
+  if($note != "")
+    DB_insert_note($note,$gameid,$myid);
+};
+output_user_notes($myid,$gameid,$mystatus);
+
+/* handle calls */
+if(myisset("call")  && $_REQUEST["call"]  == "120" && can_call(120,$me))
+  $result = DB_query("UPDATE Hand SET point_call='120' WHERE hash='$me' ");
+if(myisset("call")  && $_REQUEST["call"]  == "90" && can_call(90,$me))
+  $result = DB_query("UPDATE Hand SET point_call='90'  WHERE hash='$me' ");
+if(myisset("call")  && $_REQUEST["call"]  == "60" && can_call(60,$me))
+  $result = DB_query("UPDATE Hand SET point_call='60'  WHERE hash='$me' ");
+if(myisset("call")  && $_REQUEST["call"]  == "30" && can_call(30,$me))
+  $result = DB_query("UPDATE Hand SET point_call='30'  WHERE hash='$me' ");
+if(myisset("call")  && $_REQUEST["call"]  == "0" && can_call(0,$me))
+  $result = DB_query("UPDATE Hand SET point_call='0'   WHERE hash='$me' ");
 
 /* output extra division in case this game is part of a session */
 if($session)
@@ -1027,16 +1048,6 @@ switch($mystatus)
            DB_insert_comment($comment,$playid,$myid);
        };
 
-    /* handle notes in case player didn't play a card, allow notes only during a game */
-    if( (!myisset("card") && $mystatus=='play')  )
-      if(myisset("note"))
-       {
-         $note = $_REQUEST["note"];
-
-         if($note != "")
-           DB_insert_note($note,$gameid,$myid);
-       };
-
     /* get everything relevant to display the tricks */
     $result = DB_query("SELECT Hand_Card.card_id as card,".
                       "       Hand.position as position,".
@@ -1191,18 +1202,6 @@ switch($mystatus)
            /* update Game timestamp */
            DB_update_game_timestamp($gameid);
 
-           /* check if a call was made, must do this before we set the card status to played */
-           if(myisset("call")  && $_REQUEST["call"]  == "120" && can_call(120,$me))
-             $result = DB_query("UPDATE Hand SET point_call='120' WHERE hash='$me' ");
-           if(myisset("call")  && $_REQUEST["call"]  == "90" && can_call(90,$me))
-             $result = DB_query("UPDATE Hand SET point_call='90'  WHERE hash='$me' ");
-           if(myisset("call")  && $_REQUEST["call"]  == "60" && can_call(60,$me))
-             $result = DB_query("UPDATE Hand SET point_call='60'  WHERE hash='$me' ");
-           if(myisset("call")  && $_REQUEST["call"]  == "30" && can_call(30,$me))
-             $result = DB_query("UPDATE Hand SET point_call='30'  WHERE hash='$me' ");
-           if(myisset("call")  && $_REQUEST["call"]  == "0" && can_call(0,$me))
-             $result = DB_query("UPDATE Hand SET point_call='0'   WHERE hash='$me' ");
-
            /* mark card as played */
            DB_query("UPDATE Hand_Card SET played='true' WHERE hand_id='$handid' AND card_id=".
                     DB_quote_smart($card));
@@ -1726,13 +1725,6 @@ switch($mystatus)
       echo "  <li onclick=\"hl_next();\" class=\"old\"><a href=\"#\">next</a></li>\n";
       echo "</ul>\n"; /* end ul tricks*/
 
-      echo "<div class=\"notes\"> Personal notes: <br />\n";
-      $notes = DB_get_notes_by_userid_and_gameid($myid,$gameid);
-      foreach($notes as $note)
-       echo "$note <hr />\n";
-      echo "<input name=\"note\" type=\"text\" size=\"15\" maxlength=\"100\" />\n";
-      echo "</div> \n";
-
       $mycards = DB_get_hand($me);
       $mycards = mysort($mycards,$gametype);
       echo "<div class=\"mycards\">\n";
@@ -1903,7 +1895,6 @@ switch($mystatus)
          }
       }
 
-
     output_footer();
     DB_close();
     exit();