Skip to content

Commit 144f611

Browse files
authored
try to fix possible issue with battle being tried to start over and over again (#2863)
1 parent dfafef5 commit 144f611

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

ZkLobbyServer/autohost/Commands/CmdStart.cs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,15 @@ public override async Task ExecuteArmed(ServerBattle battle, Say e)
4242
}
4343
if (wait)
4444
{
45-
await battle.SayBattle("Game starting in 10 seconds...");
4645
battle.BlockPolls(10);
46+
await battle.SayBattle("Game starting in 10 seconds...");
4747
startTimer = new Timer(10000);
48-
startTimer.Enabled = true;
4948
startTimer.AutoReset = false;
50-
startTimer.Elapsed += (t, s) => { StartGame(battle); };
49+
startTimer.Enabled = true;
50+
startTimer.Elapsed += (t, s) => {
51+
startTimer.Enabled = false;
52+
StartGame(battle);
53+
};
5154
}
5255
else
5356
{
@@ -59,9 +62,11 @@ public override int GetPollWinMargin(ServerBattle battle, int numVoters)
5962
{
6063
// Require one more vote to start a game with uneven teams so at least one player in the smaller
6164
// team needs to agree to start the game. This is particularly relevant for the 2v1 case.
62-
if (battle.Mode == PlasmaShared.AutohostMode.Teams) {
65+
if (battle.Mode == PlasmaShared.AutohostMode.Teams)
66+
{
6367
return base.GetPollWinMargin(battle, numVoters) + numVoters % 2;
64-
} else
68+
}
69+
else
6570
{
6671
return base.GetPollWinMargin(battle, numVoters);
6772
}

0 commit comments

Comments
 (0)