diff options
author | Arun Persaud <arun@nubati.net> | 2010-03-13 15:59:07 -0800 |
---|---|---|
committer | Arun Persaud <arun@nubati.net> | 2010-03-13 16:05:39 -0800 |
commit | 850378a3e2da48d387dc565cc6e3c2b47f12e34d (patch) | |
tree | 440028bb1cdcdf1d00bb67b73319a047ec726c2b | |
parent | cf764594cd00e66ee812c5d63b016bf286178f67 (diff) | |
download | e-DoKo-850378a3e2da48d387dc565cc6e3c2b47f12e34d.tar.gz e-DoKo-850378a3e2da48d387dc565cc6e3c2b47f12e34d.tar.bz2 e-DoKo-850378a3e2da48d387dc565cc6e3c2b47f12e34d.zip |
NEW FEATURE: having only low trump (fox and below) can now be a Vorbehalt
The low trump can either be treated as poverty or similar to 5 nines, that is the game is canceled unless someone plays a solo.
Also minor code cleanup.
-rw-r--r-- | create_database.sql | 7 | ||||
-rw-r--r-- | include/db.php | 15 | ||||
-rw-r--r-- | include/functions.php | 52 | ||||
-rw-r--r-- | include/game.php | 98 | ||||
-rw-r--r-- | include/newgame.php | 5 | ||||
-rw-r--r-- | include/output.php | 40 | ||||
-rw-r--r-- | update_db.php | 16 |
7 files changed, 176 insertions, 57 deletions
diff --git a/create_database.sql b/create_database.sql index e9577c9..71a6dfc 100644 --- a/create_database.sql +++ b/create_database.sql @@ -48,7 +48,7 @@ CREATE TABLE `Version` ( /*!40000 ALTER TABLE `Card` DISABLE KEYS */; LOCK TABLES `Version` WRITE; -INSERT INTO `Version` VALUES (1); +INSERT INTO `Version` VALUES (2); UNLOCK TABLES; /*!40000 ALTER TABLE `Version` ENABLE KEYS */; @@ -141,7 +141,7 @@ CREATE TABLE `Game` ( `sickness` int(11) default NULL, `startplayer` tinyint(4) default '1', `player` int(11) default NULL, - `status` enum('pre','play','gameover','cancel-timedout','cancel-nines','cancel-trump','cancel-noplay') default NULL, + `status` enum('pre','play','gameover','cancel-timedout','cancel-nines','cancel-trump','cancel-noplay','cancel-lowtrump') default NULL, `ruleset` int(11) default NULL, `session` int(11) default NULL, `id` int(11) NOT NULL auto_increment, @@ -171,6 +171,7 @@ CREATE TABLE `Rulesets` ( `dullen` enum('none','firstwins','secondwins') default 'secondwins', `schweinchen` enum ('none','both','second','secondaftercall') default 'second', `call` enum ('1st-own-card','5th-card','9-cards') default '1st-own-card', + `lowtrump` enum('poverty','cancel','none') default 'poverty', `id` int(11) NOT NULL auto_increment, UNIQUE KEY `id` (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=utf8; @@ -200,7 +201,7 @@ CREATE TABLE `Hand` ( `status` enum('start','init','check','poverty','play','gameover') default 'start', `position` tinyint(4) NOT NULL default '0', `party` enum('re','contra') default NULL, - `sickness` enum('wedding','nines','poverty','solo') default NULL, + `sickness` enum('wedding','nines','poverty','solo','lowtrump') default NULL, `solo` enum('trumpless','jack','queen','trump','club','spade','heart','silent') default NULL, `point_call` enum('120','90','60','30','0') default NULL, UNIQUE KEY `id` (`id`), diff --git a/include/db.php b/include/db.php index 5503a4a..2a927f5 100644 --- a/include/db.php +++ b/include/db.php @@ -30,7 +30,7 @@ if(!isset($HOST)) function DB_open() { - $version_needed = 1; + $version_needed = 2; global $DB,$DB_user,$DB_host,$DB_database,$DB_password; $DB = @mysql_connect($DB_host,$DB_user, $DB_password); @@ -703,14 +703,15 @@ function DB_get_hashes_by_session($session,$user) return $r; } -function DB_get_ruleset($dullen,$schweinchen,$call) +function DB_get_ruleset($dullen,$schweinchen,$call,$lowtrump) { $r = array(); $result = DB_query("SELECT id FROM Rulesets WHERE". " dullen=".DB_quote_smart($dullen)." AND ". " Rulesets.call=".DB_quote_smart($call)." AND ". - " schweinchen=".DB_quote_smart($schweinchen)); + " schweinchen=".DB_quote_smart($schweinchen)." AND ". + " lowtrump=".DB_quote_smart($lowtrump)); if($result) $r = DB_fetch_array($result); @@ -722,6 +723,7 @@ function DB_get_ruleset($dullen,$schweinchen,$call) $result = DB_query("INSERT INTO Rulesets VALUES (NULL, NULL, ". DB_quote_smart($dullen).",". DB_quote_smart($schweinchen).",". + DB_quote_smart($lowtrump).",". DB_quote_smart($call). ", NULL)"); if($result) @@ -834,9 +836,10 @@ function DB_get_RULES($gameid) " LEFT JOIN Game ON Game.ruleset=Rulesets.id ". " WHERE Game.id='$gameid'" ); - $RULES["dullen"] = $r[2]; - $RULES["schweinchen"] = $r[3]; - $RULES["call"] = $r[4]; + $RULES['dullen'] = $r[2]; + $RULES['schweinchen'] = $r[3]; + $RULES['lowtrump'] = $r[4]; + $RULES['call'] = $r[5]; return $RULES; } diff --git a/include/functions.php b/include/functions.php index 173ccd4..a06f3d4 100644 --- a/include/functions.php +++ b/include/functions.php @@ -455,6 +455,39 @@ function count_trump($cards,$status='pregame') return $trump; } +function check_low_trump($cards) +{ + global $RULES; + + if($RULES['lowtrump']=='none') + return 0; + + /* check if we have low trump */ + + $lowtrump=1; + foreach($cards as $card) + { + /* card a trump, but not a diamond? */ + if( $card<19 ) + $lowtrump=0; + } + + /* handle case where player has schweinchen */ + if( in_array("19",$cards) && in_array("20",$cards) ) + switch($RULES["schweinchen"]) + { + case "both": + case "second": + case "secondaftercall": + $lowtrump=0; + break; + case "none": + break; + } + + return $lowtrump; +} + function create_array_of_random_numbers($useridA,$useridB,$useridC,$useridD) { global $debug; @@ -467,12 +500,12 @@ function create_array_of_random_numbers($useridA,$useridB,$useridC,$useridD) $r[ 1]=2; $r[13]=23; $r[25]=14; $r[37]=38; $r[ 2]=3; $r[14]=27; $r[26]=15; $r[38]=39; $r[ 3]=4; $r[15]=16; $r[27]=28; $r[39]=40; - $r[ 4]=5; $r[16]=17; $r[28]=29; $r[40]=41; + $r[ 4]=5; $r[16]=17; $r[28]=29; $r[40]=21; $r[ 5]=18; $r[17]=6; $r[29]=30; $r[41]=42; - $r[ 6]=21; $r[18]=7; $r[30]=31; $r[42]=43; - $r[ 7]=22; $r[19]=8; $r[31]=32; $r[43]=44; - $r[ 8]=45; $r[20]=9; $r[32]=19; $r[44]=33; - $r[ 9]=46; $r[21]=10; $r[33]=20; $r[45]=24; + $r[ 6]=41; $r[18]=7; $r[30]=31; $r[42]=43; + $r[ 7]=22; $r[19]=8; $r[31]=32; $r[43]=20; + $r[ 8]=45; $r[20]=9; $r[32]=33; $r[44]=19; + $r[ 9]=46; $r[21]=10; $r[33]=44; $r[45]=24; $r[10]=35; $r[22]=11; $r[34]=48; $r[46]=25; $r[11]=36; $r[23]=12; $r[35]=34; $r[47]=26; } @@ -933,7 +966,7 @@ function display_table () echo " Schweinchen. <br />"; if($GT=="poverty" && $party=="re") - if($sickness=="poverty") + if($sickness=="poverty" || ($RULES['lowtrump']=='poverty' && $sickness=='lowtrump')) { $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); $cards = DB_get_all_hand($userhash); @@ -948,7 +981,7 @@ function display_table () if($GT=="dpoverty") if($party=="re") - if($sickness=="poverty") + if($sickness=="poverty" || ($RULES['lowtrump']=='poverty' && $sickness=='lowtrump')) { $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); $cards = DB_get_all_hand($userhash); @@ -961,7 +994,7 @@ function display_table () else echo " <img src=\"pics/button/poverty_partner_button.png\" class=\"button\" alt=\"poverty >\" title=\"poverty partner\" />"; else - if($sickness=="poverty") + if($sickness=="poverty" || ($RULES['lowtrump']=='poverty' && $sickness=='lowtrump')) { $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); $cards = DB_get_all_hand($userhash); @@ -1438,6 +1471,9 @@ function cancel_game($why,$gameid) case 'noplay': DB_query("UPDATE Game SET status='cancel-noplay' WHERE id=$gameid"); break; + case 'lowtrump': + DB_query("UPDATE Game SET status='cancel-lowtrump' WHERE id=$gameid"); + break; } /* set each player to gameover */ $result = DB_query("SELECT id FROM Hand WHERE game_id=".DB_quote_smart($gameid)); diff --git a/include/game.php b/include/game.php index 93ab461..3cc1d65 100644 --- a/include/game.php +++ b/include/game.php @@ -223,6 +223,7 @@ if($session) echo " 10ofhearts : {$RULES['dullen']} <br />\n"; echo " schweinchen: {$RULES['schweinchen']} <br />\n"; echo " call: {$RULES['call']} <br />\n"; + echo " lowtrump: {$RULES['lowtrump']} <br />\n"; echo " </div>\n </div>\n"; /* show score */ @@ -400,7 +401,7 @@ switch($mystatus) $mycards = DB_get_hand($me); $mycards = mysort($mycards,$gametype); - if(!myisset('solo','wedding','poverty','nines') ) + if(!myisset('solo','wedding','poverty','nines','lowtrump') ) { /* output sickness of other playes, in case the already selected and are sitting in front of the current player */ echo "\n<ul class=\"tricks\">\n"; @@ -439,9 +440,10 @@ switch($mystatus) /* check if someone selected more than one sickness */ $Nsickness = 0; if($_REQUEST['solo']!='No') $Nsickness++; - if($_REQUEST['wedding'] == 'yes') $Nsickness++; - if($_REQUEST['poverty'] == 'yes') $Nsickness++; - if($_REQUEST['nines'] == 'yes') $Nsickness++; + if($_REQUEST['wedding'] == 'yes') $Nsickness++; + if($_REQUEST['poverty'] == 'yes') $Nsickness++; + if($_REQUEST['nines'] == 'yes') $Nsickness++; + if($_REQUEST['lowtrump'] == 'yes') $Nsickness++; if($Nsickness>1) { @@ -503,6 +505,16 @@ switch($mystatus) " is playing solo, this game will be canceled.<br />\n"; DB_set_sickness_by_hash($me,'nines'); } + else if($_REQUEST['lowtrump'] == 'yes') + { + if($RULES['lowtrump']=='cancel') + echo "What? You just don't want to play a game because you have low trump? Well, if no one". + " is playing solo, this game will be canceled.<br />\n"; + else + echo "Don't think you can win with low trumps...? ok, poverty chosen <br />.<br />\n"; + + DB_set_sickness_by_hash($me,'lowtrump'); + } echo "</p>\n"; @@ -592,7 +604,7 @@ switch($mystatus) $startplayer = DB_get_startplayer_by_gameid($gameid); /* check for sickness */ - $nines = 0; + $cancel = 0; $poverty = 0; $wedding = 0; $solo = 0; @@ -600,12 +612,13 @@ switch($mystatus) { $name = DB_get_name('userid',$user); $usersick = DB_get_sickness_by_userid_and_gameid($user,$gameid); - if($usersick == 'nines') + if($usersick == 'nines' || ($RULES['lowtrump']=='cancel' && $usersick=='lowtrump') ) { - $nines = $user; + $cancel = $user; + $cancelsick = $usersick; break; /* no need to check for other poverties, since only solo can win and that is already set */ } - else if($usersick == 'poverty') + else if($usersick == 'poverty' || ($RULES['lowtrump']=='poverty' && $usersick=='lowtrump')) $poverty++; else if($usersick == 'wedding') $wedding=$user; @@ -618,13 +631,35 @@ switch($mystatus) { /* do nothing */ } - else if($nines) + else if($cancel) { /* cancel game */ - $message = "The game has been canceled because ".DB_get_name('userid',$nines). - " has five or more nines and nobody is playing solo.\n\n". - "To redeal either start a new game or, in case the game was part of a tournament,\n". - "go to the last game and use the link at the bottom of the page to redeal.\n\n"; + if($cancelsick == 'nines') + { + $message = "The game has been canceled because ".DB_get_name('userid',$cancel). + " has five or more nines and nobody is playing solo.\n\n". + "To redeal either start a new game or, in case the game was part of a tournament,\n". + "go to the last game and use the link at the bottom of the page to redeal.\n\n"; + + /* update game status */ + cancel_game('nines',$gameid); + + echo "<p>The game has been canceled because ".DB_get_name('userid',$cancel). + " has five or more nines and nobody is playing solo.</p>\n"; + } + else if ($cancelsick == 'lowtrump') + { + $message = "The game has been canceled because ".DB_get_name('userid',$cancel). + " has low trump and nobody is playing solo.\n\n". + "To redeal either start a new game or, in case the game was part of a tournament,\n". + "go to the last game and use the link at the bottom of the page to redeal.\n\n"; + + /* update game status */ + cancel_game('lowtrump',$gameid); + + echo "<p>The game has been canceled because ".DB_get_name('userid',$cancel). + " has low trump and nobody is playing solo.</p>\n"; + }; $userids = DB_get_all_userid_by_gameid($gameid); foreach($userids as $user) @@ -633,11 +668,6 @@ switch($mystatus) mymail($user,$subject,$message); } - /* update game status */ - cancel_game('nines',$gameid); - - echo "<p>The game has been canceled because ".DB_get_name('userid',$nines). - " has five or more nines and nobody is playing solo.</p>\n"; echo "</div>\n"; break; } @@ -649,7 +679,7 @@ switch($mystatus) if(!$who) { $firstsick = DB_get_sickness_by_pos_and_gameid(1,$gameid); - if($firstsick == 'poverty') + if($firstsick == 'poverty' || ($RULES['lowtrump']=='poverty' && $firstsick=='lowtrump')) DB_set_sickness_by_gameid($gameid,2); /* who needs to be asked first */ else DB_set_sickness_by_gameid($gameid,1); /* who needs to be asked first */ @@ -663,10 +693,10 @@ switch($mystatus) if(!$who) { $firstsick = DB_get_sickness_by_pos_and_gameid(1,$gameid); - if($firstsick == 'poverty') + if($firstsick == 'poverty' || ($RULES['lowtrump']=='poverty' && $firstsick=='lowtrump')) { - $seconsick = DB_get_sickness_by_pos_and_gameid(1,$gameid); - if($secondsick == 'poverty') + $secondsick = DB_get_sickness_by_pos_and_gameid(1,$gameid); + if($secondsick == 'poverty' || ($RULES['lowtrump']=='poverty' && $secondsick=='lowtrump')) DB_set_sickness_by_gameid($gameid,30); /* who needs to be asked first */ else DB_set_sickness_by_gameid($gameid,20); /* who needs to be asked first */ @@ -726,7 +756,7 @@ switch($mystatus) case 'dpoverty': /* set person with poverty to play status */ $usersick = DB_get_sickness_by_userid_and_gameid($userid,$gameid); - if($usersick == 'poverty') + if($usersick == 'poverty' || ($RULES['lowtrump']=='poverty' && $usersick=='lowtrump')) DB_set_hand_status_by_hash($userhash,'play'); /* set status of first player to be asked to poverty */ @@ -806,6 +836,7 @@ switch($mystatus) echo "</div>\n"; break; } + echo "</div>\n"; case 'poverty': /* user only gets here in a poverty game, several things have to be handled here: * A) ask, if user wants to take trump @@ -919,7 +950,7 @@ switch($mystatus) $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); $userparty = DB_get_party_by_hash($userhash); - if($usersick=='poverty' && !$userparty) + if(($usersick=='poverty'|| ($RULES['lowtrump']=='poverty' && $usersick=='lowtrump')) && !$userparty) { $hash = DB_get_hash_from_gameid_and_userid($gameid,$user); $cards = DB_get_hand($hash); @@ -927,7 +958,10 @@ switch($mystatus) $nrtrump = 0; foreach($cards as $card) if($card<27) $nrtrump++; - echo "Player $name has $nrtrump trump. Do you want to take them?". + $low=''; + if($usersick=='lowtrump') + $low='low'; + echo "Player $name has $nrtrump $low trump. Do you want to take them?". "<a href=\"index.php?action=game&me=$me&trump=$user\">Yes</a> <br />\n"; } } @@ -956,9 +990,9 @@ switch($mystatus) /* don't ask people who have poverty */ $next=1; - if($firstsick=='poverty') + if($firstsick=='poverty' || ($RULES['lowtrump']=='poverty' && $firstsick=='lowtrump')) { - if($secondsick=='poverty') + if($secondsick=='poverty'|| ($RULES['lowtrump']=='poverty' && $secondsick=='lowtrump')) $next=3; else $next=2; @@ -1073,8 +1107,8 @@ switch($mystatus) $secondsick = (string) DB_get_sickness_by_pos_and_gameid($mypos+2,$gameid); $next=1; - if($firstsick=='poverty') - if($secondsick=='poverty') + if($firstsick=='poverty'|| ($RULES['lowtrump']=='poverty' && $firstsick=='lowtrump')) + if($secondsick=='poverty'|| ($RULES['lowtrump']=='poverty' && $secondsick=='lowtrump')) $next=3; else $next=2; @@ -1097,7 +1131,7 @@ switch($mystatus) echo "<div class=\"message\">Please, <a href=\"$INDEX?action=game&me=$me\">continue</a> here.</div>\n"; } } - echo "</div>"; + echo "</div>\n"; break; case 'play': @@ -1116,9 +1150,11 @@ switch($mystatus) echo "<div class=\"message\"><p>The game has been canceled because one player wasn't responding.</p><p>If this was a mistake all 4 players need to send an Email to $ADMIN_NAME at $ADMIN_EMAIL requesting that the game should be restarted.</p></div>"; break; case 'cancel-nines': - case 'cancel-timedout': echo "<div class=\"message\"><p>The game has been canceled because one player had too many nines.</p></div>"; break; + case 'cancel-lowtrump': + echo "<div class=\"message\"><p>The game has been canceled because one player had low trump.</p></div>"; + break; case 'cancel-trump': echo "<div class=\"message\"><p>The game has been canceled because nobody wanted to take the trump.</p></div>"; break; diff --git a/include/newgame.php b/include/newgame.php index d7a2d7f..f06bebe 100644 --- a/include/newgame.php +++ b/include/newgame.php @@ -40,7 +40,7 @@ else DB_update_user_timestamp($myid); - if( !myisset("PlayerA", "PlayerB","PlayerC","PlayerD","dullen","schweinchen","callrule" )) + if( !myisset("PlayerA", "PlayerB","PlayerC","PlayerD","dullen","schweinchen","callrule","lowtrump" )) { /* only get players that want to be in new games */ $names = DB_get_all_user_names_open_for_games(); @@ -80,6 +80,7 @@ else $dullen = $_REQUEST["dullen"]; $schweinchen = $_REQUEST["schweinchen"]; $call = $_REQUEST["callrule"]; + $lowtrump = $_REQUEST["lowtrump"]; /* get the emails addresses of the players */ $EmailA = DB_get_email('name',$PlayerA); @@ -142,7 +143,7 @@ else else /* no follow up, start a new session */ { /* get ruleset information or create new one */ - $ruleset = DB_get_ruleset($dullen,$schweinchen,$call); + $ruleset = DB_get_ruleset($dullen,$schweinchen,$call,$lowtrump); if($ruleset <0) { myerror("Error defining ruleset: $ruleset"); diff --git a/include/output.php b/include/output.php index 018372b..135fe13 100644 --- a/include/output.php +++ b/include/output.php @@ -123,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> - <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> + <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> @@ -205,10 +214,11 @@ function display_link_card($card,$dir="english",$type="card") function output_check_for_sickness($me,$mycards) { + global $RULES; ?> <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> @@ -245,7 +255,7 @@ function output_check_for_sickness($me,$mycards) 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\" />"; @@ -256,6 +266,26 @@ function output_check_for_sickness($me,$mycards) 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 type=\"hidden\" name=\"lowtrump\" value=\"no\" />"; + echo "<input type=\"hidden\" name=\"me\" value=\"$me\" />\n"; echo "<input type=\"submit\" value=\"count me in\" />\n"; @@ -556,7 +586,7 @@ function output_exchanged_cards() */ /* need some information about the game */ - global $gameid,$mygametype, $PREF,$me,$mystatus; + global $gameid,$mygametype, $PREF,$me,$mystatus, $RULES; /* some variables to track where the people with poverty are sitting */ $partnerpos1 = 0; @@ -573,7 +603,7 @@ function output_exchanged_cards() for($mypos=1;$mypos<5;$mypos++) { $usersick = DB_get_sickness_by_pos_and_gameid($mypos,$gameid); - if($usersick == 'poverty') + if($usersick == 'poverty' || ($RULES['lowtrump']=='poverty' && $usersick=='lowtrump')) if($povertypos1) $povertypos2 = $mypos; else diff --git a/update_db.php b/update_db.php index deae974..498b24e 100644 --- a/update_db.php +++ b/update_db.php @@ -28,7 +28,8 @@ include_once("./include/functions.php"); /* the rest */ config_check(); /* open the database */ -if(DB_open()<0) +$return = DB_open(); +if($return<0 && $return != -2) /* -2 = wrong DB version is ok */ exit(); /* only callable via cron or CLI */ @@ -36,7 +37,7 @@ if(isset($_SERVER['REMOTE_ADDR'])) exit(); $old_version = DB_get_version(); -$current_version = 1; +$current_version = 2; if($old_version < $current_version) echo "Will upgrade your database now:\n"; @@ -56,6 +57,17 @@ switch($old_version) " index (email))"); DB_query("UPDATE Version set version=1"); echo "Upgraded to version 1.\n"; + case 1: + /* add new rules */ + DB_query("ALTER TABLE Rulesets". + " ADD COLUMN `lowtrump` enum('poverty','cancel','none') default 'poverty' AFTER schweinchen"); + DB_query("ALTER TABLE Hand". + " MODIFY COLUMN `sickness` enum('wedding','nines','poverty','solo','lowtrump') default NULL"); + DB_query("ALTER TABLE Game". + " MODIFY COLUMN `status` enum('pre','play','gameover','cancel-timedout','cancel-nines','cancel-trump','cancel-noplay','cancel-lowtrump') default NULL"); + + DB_query("UPDATE Version set version=2"); + echo "Upgraded to version 2.\n"; } ?>
\ No newline at end of file |