NEW FEATURE: added localization support
[e-DoKo.git] / include / output.php
index 61fef6004fbe5d60d8c1087ec5db8ad54edc1570..79e42c276f130c879ee10f06deb9af6392b40b09 100644 (file)
@@ -1,4 +1,23 @@
 <?php
 <?php
+/* Copyright 2006, 2007, 2008, 2009, 2010 Arun Persaud <arun@nubati.net>
+ *
+ *   This file is part of e-DoKo.
+ *
+ *   e-DoKo is free software: you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation, either version 3 of the License, or
+ *   (at your option) any later version.
+ *
+ *   e-DoKo is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with e-DoKo.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
 /* make sure that we are not called from outside the scripts,
  * use a variable defined in config.php to check this
  */
 /* make sure that we are not called from outside the scripts,
  * use a variable defined in config.php to check this
  */
@@ -12,7 +31,7 @@ function output_ask_for_new_game($playerA,$playerB,$playerC,$playerD,$oldgameid)
   global $RULES;
 
   echo "<div class=\"message\">\n<form action=\"index.php?action=new\" method=\"post\">\n";
   global $RULES;
 
   echo "<div class=\"message\">\n<form action=\"index.php?action=new\" method=\"post\">\n";
-  echo "Do you want to continue playing?(This will start a new game, with $playerD as dealer.)\n";
+  echo "Do you want to continue playing?(This will start a new game, with $playerA starting the game.)\n";
   echo "  <input type=\"hidden\" name=\"PlayerA\" value=\"$playerA\" />\n";
   echo "  <input type=\"hidden\" name=\"PlayerB\" value=\"$playerB\" />\n";
   echo "  <input type=\"hidden\" name=\"PlayerC\" value=\"$playerC\" />\n";
   echo "  <input type=\"hidden\" name=\"PlayerA\" value=\"$playerA\" />\n";
   echo "  <input type=\"hidden\" name=\"PlayerB\" value=\"$playerB\" />\n";
   echo "  <input type=\"hidden\" name=\"PlayerC\" value=\"$playerC\" />\n";
@@ -104,10 +123,19 @@ function output_form_for_new_game($names)
      <p>
        <select name="callrule">
         <option value="1st-own-card" selected="selected">  Can call re/contra on the first <strong>own</strong> card played, 90 on the second, etc.</option>
      <p>
        <select name="callrule">
         <option value="1st-own-card" selected="selected">  Can call re/contra on the first <strong>own</strong> card played, 90 on the second, etc.</option>
-        <option value="5th-card">  Can call re/contra until 5th card is played, 90 until 9th card is played, etc.</option>
+        <option value="5th-card"> Can call re/contra until 5th card is played, 90 until 9th card is played, etc.</option>
         <option value="9-cards" > Can call re/contra until 5th card is played, 90 if player still has 9 cards, etc.</option>
        </select>
      </p>
         <option value="9-cards" > Can call re/contra until 5th card is played, 90 if player still has 9 cards, etc.</option>
        </select>
      </p>
+     <h4>Low trump</h4>
+     <p>
+       Player can't trump a fox, that is none of his trump is higher than a fox.
+       <select name="lowtrump">
+        <option value="poverty">The trump will be treated as poverty and offered to another player.</option>
+        <option value="cancel">  The game will be canceled unless there is a solo.</option>
+        <option value="none">   Bad luck, the player needs to play a normal game.</option>
+       </select>
+     </p>
      <h3>Scoring-related</h3>
      <h4>(not yet implemented)</h4>
      <p><input type="submit" value="start game"></p>
      <h3>Scoring-related</h3>
      <h4>(not yet implemented)</h4>
      <p><input type="submit" value="start game"></p>
@@ -186,10 +214,11 @@ function display_link_card($card,$dir="english",$type="card")
 
 function output_check_for_sickness($me,$mycards)
 {
 
 function output_check_for_sickness($me,$mycards)
 {
+  global $RULES;
  ?>
   <div class="sickness"> Thanks for joining the game...<br />
 
  ?>
   <div class="sickness"> Thanks for joining the game...<br />
 
-    do you want to play solo?
+    Do you want to play solo?
     <select name="solo" size="1">
       <option selected="selected">No</option>
       <option>trumpless</option>
     <select name="solo" size="1">
       <option selected="selected">No</option>
       <option>trumpless</option>
@@ -226,7 +255,7 @@ function output_check_for_sickness($me,$mycards)
       echo " no <input type=\"hidden\" name=\"poverty\" value=\"no\" /> <br />\n";
     };
 
       echo " no <input type=\"hidden\" name=\"poverty\" value=\"no\" /> <br />\n";
     };
 
-   echo "Do you have too many nines?";
+  echo "Do you have too many nines?";
   if(count_nines($mycards)>4)
      {
        echo " yes<input type=\"radio\" name=\"nines\" value=\"yes\" checked=\"checked\" />";
   if(count_nines($mycards)>4)
      {
        echo " yes<input type=\"radio\" name=\"nines\" value=\"yes\" checked=\"checked\" />";
@@ -237,6 +266,26 @@ function output_check_for_sickness($me,$mycards)
        echo " no <input type=\"hidden\" name=\"nines\" value=\"no\" /> <br />\n";
      };
 
        echo " no <input type=\"hidden\" name=\"nines\" value=\"no\" /> <br />\n";
      };
 
+  if($RULES['lowtrump']=='cancel' || $RULES['lowtrump']=='poverty')
+    {
+      if($RULES['lowtrump']=='cancel')
+       echo "Do you have low trump (cancel game)?";
+      else
+       echo "Do you have low trump (poverty)?";
+
+      if(check_low_trump($mycards))
+       {
+         echo " yes<input type=\"radio\" name=\"lowtrump\" value=\"yes\" checked=\"checked\" />";
+         echo " no <input type=\"radio\" name=\"lowtrump\" value=\"no\" /> <br />\n";
+       }
+      else
+       {
+         echo " no <input type=\"hidden\" name=\"lowtrump\" value=\"no\" /> <br />\n";
+       };
+    }
+  else
+    echo "<input