Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for retreat options before win #322

Merged
merged 1 commit into from May 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions gamemaster/members.php
Expand Up @@ -193,6 +193,8 @@ function findSetDefeated()
*/
function checkForWinner()
{
global $DB;

/*
* See if only one person is left over
* If more than one is left over see if any of them have the winning number of more supply centers
Expand Down Expand Up @@ -232,6 +234,14 @@ function checkForWinner()
}
else
{
// If there is a diplpmacy-phase check for a retreating-phase and wait another round for the retreats to finish.
if ($this->Game->phase == 'Diplomacy')
{
list($retreating) = $DB->sql_row("SELECT COUNT(retreatingUnitID) FROM wD_TerrStatus WHERE gameID=".$this->Game->id);
if($retreating)
return false;
}

// If more than one is left over see if any of them have supplyCenterTarget or more supply centers
foreach($this->ByStatus['Playing'] as $Member)
{
Expand Down