changed leave game shortcut, server cleanups, added max_games_per_user

This commit is contained in:
Max-Wilhelm Bruker 2011-04-21 01:52:09 +02:00
parent d0b8c6ebd9
commit 38b31681e2
11 changed files with 85 additions and 64 deletions

View file

@ -44,6 +44,7 @@ Server_Game::Server_Game(Server_ProtocolHandler *_creator, int _gameId, const QS
Server_Game::~Server_Game()
{
QMutexLocker roomLocker(&room->roomMutex);
QMutexLocker locker(&gameMutex);
sendGameEvent(new Event_GameClosed);
@ -53,7 +54,7 @@ Server_Game::~Server_Game()
delete playerIterator.next().value();
players.clear();
emit gameClosing();
room->removeGame(this);
delete creatorInfo;
qDebug("Server_Game destructor");
}
@ -233,6 +234,7 @@ Server_Player *Server_Game::addPlayer(Server_ProtocolHandler *handler, bool spec
void Server_Game::removePlayer(Server_Player *player)
{
QMutexLocker roomLocker(&room->roomMutex);
QMutexLocker locker(&gameMutex);
players.remove(player->getPlayerId());
@ -281,6 +283,7 @@ void Server_Game::removeArrowsToPlayer(Server_Player *player)
bool Server_Game::kickPlayer(int playerId)
{
QMutexLocker roomLocker(&room->roomMutex);
QMutexLocker locker(&gameMutex);
Server_Player *playerToKick = players.value(playerId);