Example #1
0
File: gan.php Project: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement') {
        $mypage = page::standard();
        $mypage->title_body('Cannot quit game');
        $mypage->leaf('p', 'You cannot presently quit this game, perhaps because it has finished. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game. You might be seeing this message because you clicked the button twice. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!@$_POST['CheckA'] or !@$_POST['CheckB']) {
        $mypage = page::standard();
        $mypage->title_body('Tick boxes left unticked');
        $mypage->leaf('p', 'One or both tick boxes were left unticked. You need to make sure both boxes are ticked - this is to prevent accidental use of the "quit" function. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['PlayersMissing'] + 1 == $GAME['CurrentPlayers']) {
        abortgame(0);
        dbformatgamedata();
        $mypage = page::standard();
        $mypage->title_body('Game aborted instead');
        $mypage->leaf('p', 'Since you were the only player left in the game, the game has instead been aborted. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    KickPlayer($GAME['MyColour'], 0);
    dbformatgamedata();
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully quit game.');
}
Example #2
0
File: gah.php Project: hdp/brass
function DoTask()
{
    global $GAME;
    if ($GAME['GameStatus'] != 'In Progress') {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to remove players from this game');
        $mypage->leaf('p', 'At the moment you cannot vote to remove players from this game. This might be because the game has finished, or it might be because the game is seeking a replacement player. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot vote to remove players. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == $GAME['PlayerToMove']) {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to kick yourself');
        $mypage->leaf('p', 'You cannot vote to kick yourself. If you want to leave the game, please select the option to "Quit" instead. Click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!$GAME['CanKickVote']) {
        $mypage = page::standard();
        $mypage->title_body('Kick vote not currently available');
        $mypage->leaf('p', 'The option to vote to kick the current player is not presently available. (Perhaps the player you were waiting for took his turn in the meantime.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!$GAME['KickVoteActive']) {
        $mypage = page::standard();
        $mypage->title_body('No vote is taking place');
        $mypage->leaf('p', 'At present, no vote on kicking the current player is taking place. (Perhaps the player you were waiting for took his turn in the meantime, or perhaps another player voted against.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (@$_POST['votevalueA']) {
        if ($GAME['PlayersVotingToKick'] - $GAME['IHaveKickVoted'] + 2 >= $GAME['CurrentPlayers']) {
            $NameOfKickedPlayer = $GAME['PlayerFullName'][$GAME['PlayerToMove']];
            KickPlayer($GAME['PlayerToMove'], 2);
            dbformatgamedata();
            page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted and kicked player.');
        }
        $GAME['KickVote'][$GAME['MyColour']] = 1;
        dbformatgamedata();
        page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
    }
    $GAME['KickVote'] = '00000';
    dbformatgamedata();
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and $i != $GAME['MyColour'] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '' and $i != $GAME['PlayerToMove']) {
            $subject = 'The vote to kick ' . $GAME['PlayerFullName'][$GAME['PlayerToMove']] . 'from game number ' . $GAME['GameID'] . ' has failed';
            $body = '<p>This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has voted against kicking ' . $GAME['PlayerFullName'][$GAME['PlayerToMove']] . ' from the game. In order for ' . $GAME['OtherPronounLC'][$GAME['PlayerToMove']] . ' to be kicked, all of the players must agree; this means that a unanimous vote is required. So, ' . $GAME['PronounLC'][$GAME['PlayerToMove']] . ' will not be kicked at this time. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
            send_email($subject, $body, $GAME['Email'][$i], null);
        }
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
}
Example #3
0
File: gag.php Project: hdp/brass
function DoTask()
{
    global $GAME, $unexpectederrormessage;
    if ($GAME['GameStatus'] != 'In Progress') {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to remove players from this game');
        $mypage->leaf('p', 'At the moment you cannot vote to remove players from this game. This might be because the game has finished, or it might be because the game is seeking a replacement player. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == 50) {
        $mypage = page::standard();
        $mypage->title_body('Not playing in this game');
        $mypage->leaf('p', 'You are not currently playing in this game, so you cannot vote to remove players. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['MyColour'] == $GAME['PlayerToMove']) {
        $mypage = page::standard();
        $mypage->title_body('Cannot vote to kick yourself');
        $mypage->leaf('p', 'You cannot vote to kick yourself. If you want to leave the game, please select the option to "Quit" instead. Click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if (!$GAME['CanKickVote']) {
        $mypage = page::standard();
        $mypage->title_body('Kick vote not currently available');
        $mypage->leaf('p', 'The option to vote to kick the current player is not presently available. (Perhaps the player you were waiting for took his turn in the meantime.) Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.');
        $mypage->finish();
    }
    if ($GAME['KickVoteActive']) {
        myerror($unexpectederrormessage, 'Unexpected vote page "gag.php" reached');
    }
    if ($GAME['CurrentPlayers'] - $GAME['PlayersMissing'] == 2) {
        $NameOfKickedPlayer = $GAME['PlayerFullName'][$GAME['PlayerToMove']];
        KickPlayer($GAME['PlayerToMove'], 2);
        dbformatgamedata();
        page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted and kicked player.');
    }
    $GAME['KickVote'][$GAME['MyColour']] = 1;
    dbformatgamedata();
    for ($i = 0; $i < MAX_PLAYERS; $i++) {
        if ($GAME['PlayerExists'][$i] == 1 and !$GAME['PlayerMissing'][$i] and $i != $GAME['MyColour'] and $GAME['EmailPrompt'][$i] and $GAME['Email'][$i] != '') {
            if ($i == $GAME['PlayerToMove']) {
                $subject = 'There is a vote to kick you from game number ' . $GAME['GameID'];
                $body = 'This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has initiated a vote to kick you from the game, as you are taking a long time to make your move. In order for you to be kicked, all of the other players must agree; this means that a unanimous vote is required. However, you can end the vote immediately by taking your turn. Please visit the game\'s page and shut the vote down by taking your turn. Here is the URL of the game page:' . "\n\n" . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . EMAIL_FOOTER;
            } else {
                $subject = 'There is a vote to kick ' . $GAME['PlayerFullName'][$GAME['PlayerToMove']] . ' from game number ' . $GAME['GameID'];
                $body = '<p>This is an automated message. One of your fellow players in game number ' . $GAME['GameID'] . ' has initiated a vote to kick ' . $GAME['PlayerFullName'][$GAME['PlayerToMove']] . ' from the game, as ' . $GAME['PronounLC'][$GAME['PlayerToMove']] . ' is taking a long time to make ' . $GAME['PossessivePronounLC'][$GAME['PlayerToMove']] . ' move. In order for ' . $GAME['OtherPronounLC'][$GAME['PlayerToMove']] . ' to be kicked, all of the players must agree; this means that a unanimous vote is required. Please visit the game\'s page and either vote in favour of kicking ' . $GAME['PlayerName'][$GAME['PlayerToMove']] . ', or shut the vote down by voting not to kick ' . $GAME['OtherPronounLC'][$GAME['PlayerToMove']] . '. Here is the URL of the game page:</p><p><a href="' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '">' . SITE_ADDRESS . 'board.php?GameID=' . $GAME['GameID'] . '</a></p>' . EMAIL_FOOTER;
            }
            send_email($subject, $body, $GAME['Email'][$i], null);
        }
    }
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully voted.');
}
Example #4
0
File: gad.php Project: hdp/brass
function DoTask()
{
    global $Administrator, $GAME, $unexpectederrormessage;
    $AdminKickList = sanitise_int(@$_POST['AdminKickList']);
    $PostFailureTitle = false;
    do {
        if (!$Administrator) {
            $PostFailureTitle = 'Not authorised';
            $PostFailureMessage = 'You are not authorised to make use of this page. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to return to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (!@$_POST['CheckC']) {
            $PostFailureTitle = 'Tick box left unticked';
            $PostFailureMessage = 'The tick box was left unticked. You need to make sure the box is ticked - this is to prevent accidental use of the administrator controls. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['GameStatus'] != 'In Progress' and $GAME['GameStatus'] != 'Recruiting Replacement') {
            $PostFailureTitle = 'Cannot kick player';
            $PostFailureMessage = 'Players cannot be kicked right now, perhaps because the game has finished. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($AdminKickList < 0 or $AdminKickList >= MAX_PLAYERS) {
            $PostFailureTitle = 'Invalid input';
            $PostFailureMessage = 'Expected an integer between 0 and ' . (MAX_PLAYERS - 1) . ' inclusive, but received ' . $AdminKickList . '. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if (!$GAME['PlayerExists'][$AdminKickList] or $GAME['PlayerMissing'][$AdminKickList]) {
            $PostFailureTitle = 'Seat is empty';
            $PostFailureMessage = 'The chosen seat is empty, or the chosen colour does not exist in this game. Perhaps the player was kicked in the meantime. Please click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
        if ($GAME['PlayersMissing'] + 1 == $GAME['CurrentPlayers']) {
            $PostFailureTitle = 'Only one player is not missing';
            $PostFailureMessage = 'This is the only player who is not missing. If you do not want the game to continue, please select to abort it instead. Click <a href="board.php?GameID=' . $GAME['GameID'] . '">here</a> to go to the board page, or <a href="index.php">here</a> to return to the Main Page.';
            break;
        }
    } while (false);
    if ($PostFailureTitle !== false) {
        $mypage = page::standard();
        $mypage->title_body($PostFailureTitle);
        $mypage->leaf('p', $PostFailureMessage);
        $mypage->finish();
    }
    KickPlayer($AdminKickList, 1);
    dbformatgamedata();
    page::redirect(3, 'board.php?GameID=' . $GAME['GameID'], 'Successfully kicked player.');
}
Example #5
0
File: mt.php Project: hdp/brass
                     }
                 } else {
                     abortgame(2);
                 }
             } else {
                 if ($GAME['DoWhatAtB'] == 'Kick current player; subsequently downsize') {
                     if ($GAME['GameStatus'] == 'Recruiting Replacement') {
                         downsizegame(true);
                     } else {
                         KickPlayer($GAME['PlayerToMove'], 3);
                     }
                 } else {
                     if ($GAME['GameStatus'] == 'Recruiting Replacement') {
                         abortgame(2);
                     } else {
                         KickPlayer($GAME['PlayerToMove'], 3);
                     }
                 }
             }
         }
     }
     $GAME['MoveMade'] = 1;
     $didsomething = 1;
     while ($didsomething) {
         $didsomething = gamecheck();
     }
     dbformatgamedata();
 }
 $OutputLines[] = 'Games timed out: ' . count($gamestimedout) . ', namely ' . implode(', ', $gamestimedout);
 sleep(2);
 // Be nice
Example #6
0
function downsizegame($downsizetype)
{
    global $GAME;
    $GAME['MoveMade'] = 1;
    $GAME['KickVote'] = '00000';
    $GAME['SecondRailMode'] = 0;
    $GAME['SecondDevelopMode'] = 0;
    $GAME['ContinueSellingMode'] = 0;
    if ($GAME['GameStatus'] == 'In Progress') {
        if (KickPlayer($GAME['PlayerToMove'], 3)) {
            return;
        }
        // If KickPlayer aborts the game then it will return true.
        // We don't want any shenanigans going on after a game is aborted.
    }
    $GAME['PlayersMissing']--;
    $GAME['PlayerMissing'][$GAME['PlayerToMove']] = 0;
    $GAME['PlayersMissingThatMatter']--;
    $GAME['PlayerMissingAndMatters'][$GAME['PlayerToMove']] = 0;
    dbquery(DBQUERY_WRITE, 'DELETE FROM "ReplacementOffer" WHERE "Game" = :game: AND "Colour" = :colour:', 'game', $GAME['GameID'], 'colour', $GAME['PlayerToMove']);
    $GAME['GameStatus'] = 'In Progress';
    if ($downsizetype) {
        $GAME['AltGameTicker'] .= '7A' . callmovetimediff();
    } else {
        $GAME['AltGameTicker'] .= '7B' . callmovetimediff();
    }
    $GAME['PlayerExists'][$GAME['PlayerToMove']] = 0;
    for ($i = 0; $i < $GAME['NumIndustrySpaces']; $i++) {
        if ($GAME['SpaceStatus'][$i] == $GAME['PlayerToMove']) {
            $GAME['SpaceStatus'][$i] = 8;
        }
    }
    for ($i = 0; $i < $GAME['RailPhase'] * $GAME['NumRailLinks'] + (1 - $GAME['RailPhase']) * $GAME['NumCanalLinks']; $i++) {
        if ($GAME['LinkStatus'][$i] == $GAME['PlayerToMove']) {
            $GAME['LinkStatus'][$i] = 8;
        }
    }
    switch ($GAME['CurrentPlayers']) {
        case 4:
            if ($GAME['Round'] < 3) {
                $GAME['NumRounds'] = 10;
            } else {
                if ($GAME['Round'] == 3) {
                    $GAME['NumRounds'] = 9;
                }
            }
            if (!$GAME['RailPhase'] or $GAME['Round'] < 4) {
                $GAME['EffectiveNumPlayers'] = 3;
            }
            $GAME['ShuffledDeck'] = array_reverse($GAME['ShuffledDeck']);
            if (count($GAME['ShuffledDeck']) == 1 and $GAME['ShuffledDeck'][0] === '') {
                $GAME['ShuffledDeck'] = array();
            }
            shuffle($GAME['Cards'][$GAME['PlayerToMove']]);
            for ($i = 0; $i < $GAME['HandSize'][$GAME['PlayerToMove']]; $i++) {
                $GAME['ShuffledDeck'][] = array_pop($GAME['Cards'][$GAME['PlayerToMove']]);
            }
            $GAME['ShuffledDeck'] = array_reverse($GAME['ShuffledDeck']);
            $GAME['AltGameTicker'] .= 'AAA9J';
            break;
        case 3:
            // At present, it is not permitted for games to be downsized from 3 players to 2 players.
            // This function should not be called when CurrentPlayers is equal to 3; it will stop script execution with an error message.
            die('Programming error: Downsize function called when number of players is 3. Please contact Administrator and give details of how you obtained this error message.');
            break;
        case 2:
            for ($i = 0; $i < MAX_PLAYERS; $i++) {
                if ($GAME['PlayerExists'][$i]) {
                    $TheLastPlayer = $i;
                }
            }
            if ($GAME['RailPhase'] and $GAME['NumRounds'] - $GAME['Round'] < 2) {
                require_once HIDDEN_FILES_PATH . 'scoringresource.php';
                endgamescoring();
            } else {
                $GAME['GameStatus'] = 'Finished';
                require_once HIDDEN_FILES_PATH . 'createpgr.php';
                CreatePGR(0, 0, -1, 0, $TheLastPlayer);
            }
            $GAME['AltGameTicker'] .= 'AAA9J';
            break;
    }
    $GAME['CurrentPlayers']--;
    if ($GAME['CurrentPlayers'] > 1) {
        for ($i = 0; $i < MAX_PLAYERS; $i++) {
            if ($GAME['TurnOrder'][$i] == $GAME['PlayerToMove']) {
                $WhereInTurnOrder = $i;
            }
        }
        for ($i = $WhereInTurnOrder; $i < MAX_PLAYERS - 1; $i++) {
            $GAME['TurnOrder'][$i] = $GAME['TurnOrder'][$i + 1];
        }
        $GAME['TurnOrder'][MAX_PLAYERS - 1] = $GAME['PlayerToMove'];
        if ($GAME['DebtMode']) {
            $SomeoneInDebt = 9;
            for ($i = 0; $i < MAX_PLAYERS; $i++) {
                if ($GAME['PlayerExists'][$GAME['TurnOrder'][$i]] and $GAME['Money'][$GAME['TurnOrder'][$i]] < 0) {
                    for ($j = 0; $j < $GAME['NumIndustrySpaces']; $j++) {
                        if ($GAME['SpaceStatus'][$j] == $GAME['TurnOrder'][$i]) {
                            $SomeoneInDebt = $GAME['TurnOrder'][$i];
                            break 2;
                        }
                    }
                }
            }
            if ($SomeoneInDebt == 9) {
                $GAME['DebtMode'] = 0;
                $GAME['PlayerToMove'] = $GAME['TurnOrder'][0];
            } else {
                $GAME['PlayerToMove'] = $SomeoneInDebt;
            }
        } else {
            $EndRound = true;
            for ($i = MAX_PLAYERS - 2; $i >= $WhereInTurnOrder; $i--) {
                if ($GAME['PlayerExists'][$GAME['TurnOrder'][$i]]) {
                    $GAME['PlayerToMove'] = $GAME['TurnOrder'][$i];
                    $EndRound = false;
                }
            }
            if ($EndRound) {
                if ($GAME['Round'] == $GAME['NumRounds']) {
                    if ($GAME['RailPhase']) {
                        require_once HIDDEN_FILES_PATH . 'scoringresource.php';
                        endgamescoring();
                    } else {
                        require_once HIDDEN_FILES_PATH . 'scoringresource.php';
                        require_once HIDDEN_FILES_PATH . 'turnorderresource.php';
                        canalphasescoring();
                        DoTurnOrder(1);
                    }
                } else {
                    require_once HIDDEN_FILES_PATH . 'turnorderresource.php';
                    DoTurnOrder(1);
                }
            }
        }
        if ($GAME['RailPhase'] and $GAME['Round'] == $GAME['NumRounds'] and $GAME['GameStatus'] != 'Finished') {
            require_once HIDDEN_FILES_PATH . 'nomovesresource.php';
            CheckNoMovesShell();
        }
    }
}
Example #7
0
function KickPlayer($PlayerToKick, $KickType)
{
    // This function returns true if it has called abortgame(),
    // and false otherwise.
    global $GAME;
    if (isset($GAME['KickPlayerCalls']) and $GAME['KickPlayerCalls'] > 5) {
        die('Programming error: Recursive function appears to be in unintended loop.');
    }
    if (isset($GAME['KickPlayerCalls'])) {
        $GAME['KickPlayerCalls']++;
    } else {
        $GAME['KickPlayerCalls'] = 1;
    }
    require_once HIDDEN_FILES_PATH . 'createpgr.php';
    CreatePGR(0, $KickType + 1, 0, 0, $PlayerToKick);
    // Update the row in PlayerGameRcd to reflect
    // this player's having left the game.
    $ProceedToKickOrDownsize = false;
    $ProceedToAbort = false;
    // Do I need to go on to kick the current player, downsize
    // the game, or abort the game when I've finished?
    $GAME['PlayerMissing'][$PlayerToKick] = 1;
    $GAME['PlayersMissing']++;
    // This player is now missing.
    if (!$GAME['RailPhase'] or $GAME['PlayerToMove'] == $PlayerToKick or $GAME['HandSize'][$PlayerToKick]) {
        $GAME['PlayersMissingThatMatter']++;
        $GAME['PlayerMissingAndMatters'][$PlayerToKick] = 1;
        // Provided the player should take additional decisions
        // in the game, his departure "matters".
    }
    if (!$GAME['AbortVote'][$PlayerToKick]) {
        $GAME['PlayersVotingToAbort']++;
    }
    if (!$GAME['KickVote'][$PlayerToKick]) {
        $GAME['PlayersVotingToKick']++;
    }
    // This player now counts as having voted "yes" on any vote that's happening,
    // although we have to bear in mind that a vote is only actually happening
    // if the corresponding *VoteActive variable is set to something "true".
    $GAME['AbortVote'][$PlayerToKick] = 0;
    $GAME['KickVote'][$PlayerToKick] = 0;
    // We should set this player's actual votes, however, as zero.
    if ($GAME['AbortVoteActive'] and $GAME['PlayersVotingToAbort'] == $GAME['CurrentPlayers'] - 1) {
        $ProceedToAbort = true;
        // If there's a vote on to abort the game, and this player was
        // the last person who needed to vote, then we should abort the game.
    }
    if ($PlayerToKick == $GAME['PlayerToMove']) {
        $GAME['MoveMade'] = 1;
        $GAME['KickVote'] = '00000';
        // The vote has served its purpose and is over.
    } else {
        if (!$ProceedToAbort and $GAME['KickVoteActive'] and $GAME['PlayersVotingToKick'] == $GAME['CurrentPlayers'] - 1) {
            $ProceedToKickOrDownsize = true;
            // If there's a vote on to kick the current player or to downsize
            // the game, and this player was the last person who needed to vote,
            // then we should go ahead and do it... although not if we're already
            // aborting the game. In that case we'll just abort the game and
            // ignore the rest.
        }
    }
    switch ($KickType) {
        // We add notes to the game log to say what's happening.
        case 0:
            // quit
            $GAME['AltGameTicker'] .= '4C' . callmovetimediff() . letter_end_number($PlayerToKick);
            break;
        case 1:
            // kicked by admin
            $GAME['AltGameTicker'] .= '5C' . callmovetimediff() . letter_end_number($_SESSION['MyUserID']) . letter_end_number($_SESSION['MyGenderCode']) . letter_end_number($PlayerToKick);
            $GAME['GameTickerNames'] .= '|' . $_SESSION['MyUserName'];
            break;
        case 2:
            // kicked by vote
            $GAME['AltGameTicker'] .= '5D' . callmovetimediff();
            break;
        case 3:
            // kicked by the system
            $GAME['AltGameTicker'] .= '5A' . callmovetimediff();
    }
    if ($GAME['PlayerMissing'][$GAME['PlayerToMove']]) {
        $GAME['GameStatus'] = 'Recruiting Replacement';
        // If the current "seat" is unoccupied, then we need to put this game
        // in the list of games that require replacement players.
    }
    $GAME['NumDepartures']++;
    if ($ProceedToAbort) {
        abortgame(0);
        return true;
    } else {
        if ($ProceedToKickOrDownsize) {
            if ($GAME['GameStatus'] == 'Recruiting Replacement') {
                downsizegame(false);
            } else {
                KickPlayer($GAME['PlayerToMove'], 2);
            }
        } else {
            if ($GAME['NumDepartures'] > PERMITTED_DEPARTURES) {
                // if this condition is satisfied then at some point I will have to
                // either abort or downsize the game (whichever I would do at Time Limit B).
                if ($GAME['CurrentPlayers'] - $GAME['PlayersMissingThatMatter'] == $GAME['MinimumPlayersAllowed'] and $GAME['MinimumPlayersAllowed'] > 2 or $GAME['CurrentPlayers'] == 3 or $GAME['DoWhatAtB'] == 'Kick current player; subsequently abort' or $GAME['DoWhatAtB'] == 'Abort') {
                    // In this situation I'll have to abort the game sooner or later,
                    // so I may as well abort it right now.
                    abortgame(2);
                    return true;
                } else {
                    if ($GAME['GameStatus'] == 'Recruiting Replacement') {
                        // If the current seat is empty then it's time to downsize the game.
                        downsizegame(true);
                    }
                }
            }
        }
    }
    return false;
}