mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
mutex and ghost games fixes
This commit is contained in:
parent
8e0f7dcf03
commit
6d5b29395c
4 changed files with 9 additions and 14 deletions
|
|
@ -64,8 +64,11 @@ void Server_Game::pingClockTimeout()
|
|||
QList<ServerInfo_PlayerPing *> pingList;
|
||||
QMapIterator<int, Server_Player *> playerIterator(players);
|
||||
bool allPlayersInactive = true;
|
||||
int playerCount = 0;
|
||||
while (playerIterator.hasNext()) {
|
||||
Server_Player *player = playerIterator.next().value();
|
||||
if (!player->getSpectator())
|
||||
++playerCount;
|
||||
int pingTime;
|
||||
if (player->getProtocolHandler()) {
|
||||
pingTime = player->getProtocolHandler()->getLastCommandTime();
|
||||
|
|
@ -78,7 +81,7 @@ void Server_Game::pingClockTimeout()
|
|||
|
||||
const int maxTime = static_cast<Server_Room *>(parent())->getServer()->getMaxGameInactivityTime();
|
||||
if (allPlayersInactive) {
|
||||
if ((++inactivityCounter >= maxTime) && (maxTime > 0))
|
||||
if (((++inactivityCounter >= maxTime) && (maxTime > 0)) || (playerCount < maxPlayers))
|
||||
deleteLater();
|
||||
} else
|
||||
inactivityCounter = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue