if( $b/2 - (int)($b/2) != 0.5)
$b--;
- /* some special cases */
+ /* check for schweinchen and ten of hearts*/
switch($game)
{
case "normal":
case "silent":
+ case "trump":
if($RULES["schweinchen"]=="both" && $GAME["schweinchen"])
{
if($a == 19 || $a == 20 )
if($b == 19 || $b == 20 )
return 0;
};
- case "trump":
case "heart":
case "spade":
case "club":
+ /* check for ten of hearts rule */
if($RULES["dullen"]=="secondwins")
if($a==1 && $b==1) /* both 10 of hearts */
return 0; /* second one wins.*/
+ case "trumpless":
+ case "jack":
+ case "queen":
+ /* no special cases here */
}
/* normal case */
return;
}
-function return_timezone($offset)
-{
- switch($offset)
- {
- case '1':
- $zone = "Europe/Berlin";
- break;
- case '-8':
- $zone = "America/Vancouver";
- break;
- case '13':
- $zone = "Pacific/Auckland";
- break;
- default:
- $zone = "Europe/London";
- }
-
- return $zone;
-}
-
function have_suit($cards,$c)
{
global $CARDS;
function display_table ()
{
- global $gameid, $GT, $debug,$host;
+ global $gameid, $GT, $debug,$INDEX,$defaulttimezone;
$result = mysql_query("SELECT User.fullname as name,".
" Hand.position as position, ".
" Hand.sickness as sickness, ".
" Hand.point_call, ".
" User.last_login, ".
- " Hand.hash ".
+ " Hand.hash, ".
+ " User.timezone ".
"FROM Hand ".
"LEFT JOIN User ON User.id=Hand.user_id ".
"WHERE Hand.game_id='".$gameid."' ".
"ORDER BY position ASC");
echo "<div class=\"table\">\n".
- " <img src=\"pics/table.png\" alt=\"table\" />\n";
+ " <img class=\"table\" src=\"pics/table.png\" alt=\"table\" />\n";
while($r = mysql_fetch_array($result,MYSQL_NUM))
{
$name = $r[0];
$party = $r[3];
$sickness = $r[4];
$call = $r[5];
- $lastlogin = strtotime($r[6]);
$hash = $r[7];
-
- $offset = DB_get_user_timezone($user);
- $zone = return_timezone($offset);
- date_default_timezone_set($zone);
+ $timezone = $r[8];
+ date_default_timezone_set($defaulttimezone);
+ $lastlogin = strtotime($r[6]);
+ date_default_timezone_set($timezone);
+ $timenow = strtotime(date("Y-m-d H:i:s"));
echo " <div class=\"table".($pos-1)."\">\n";
if(!$debug)
echo " $name \n";
else
- echo " <a href=\"".$host."?me=".$hash."\">$name</a>\n";
+ echo " <a href=\"".$INDEX."?me=".$hash."\">$name</a>\n";
/* add hints for poverty, wedding, solo, etc */
if($GT=="poverty" && $party=="re")
}
echo " <br />\n";
- echo " <span title=\"".date("Y-m-d H:i:s")."\">local time</span>\n";
+ echo " <span title=\"".date("Y-m-d H:i:s",$timenow). "\">local time</span>\n";
echo " <span title=\"".date("Y-m-d H:i:s",$lastlogin)."\">last login</span>\n";
echo " </div>\n";
function display_user_menu()
{
- global $wiki,$myid,$host;
+ global $WIKI,$myid,$INDEX,$STATS;
echo "<div class=\"usermenu\">\n".
- "<a href=\"index.php\"> go to my user page </a>";
+ "<a href=\"".$INDEX."\"> Go to my user page </a>";
$result = mysql_query("SELECT Hand.hash,Hand.game_id,Game.player from Hand".
" LEFT JOIN Game On Hand.game_id=Game.id".
" WHERE Hand.user_id='$myid'".
" AND Game.player='$myid'".
- " AND Game.status<>'gameover'" );
+ " AND Game.status<>'gameover'".
+ " ORDER BY Game.session" );
if(mysql_num_rows($result))
echo "<hr />It's your turn in these games:<br />\n";
while( $r = mysql_fetch_array($result,MYSQL_NUM))
{
- echo "<a href=\"".$host."?me=".$r[0]."\">game ".DB_format_gameid($r[1])." </a><br />\n";
+ echo "<a href=\"".$INDEX."?me=".$r[0]."\">game ".DB_format_gameid($r[1])." </a><br />\n";
}
- echo "<hr /> <a href=\"".$host."?new\">start a new game</a>\n";
+ echo "<hr /> <a href=\"".$INDEX."?new\">Start a new game</a>\n";
- echo "<hr /> <a href=\"".substr($host,0,-9)."stats.php\">Statistics</a>\n";
+ echo "<hr /> <a href=\"".$STATS."\">Statistics</a>\n";
echo
- "<hr />Report bugs in the <a href=\"". $wiki."\">wiki</a>\n";
+ "<hr />Report bugs in the <a href=\"".$WIKI."\">wiki</a>\n";
echo "</div>\n";
return;
}