summaryrefslogtreecommitdiffstats
path: root/sigencore/Arena.cpp
diff options
context:
space:
mode:
authorBen Boeckel <MathStuf@gmail.com>2009-02-12 00:44:46 -0500
committerBen Boeckel <MathStuf@gmail.com>2009-02-12 00:44:46 -0500
commit028f9a53fca0de9c4179029ca38a4d914ce5046b (patch)
treeac5603d68d620bdc50d8e003ca6a95f16c5354a0 /sigencore/Arena.cpp
parentae8486fe31fa80762a24d5e6fda877aa7f803be2 (diff)
Reorganized addClient and added a way to set up rules in Arenas
Diffstat (limited to 'sigencore/Arena.cpp')
-rw-r--r--sigencore/Arena.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/sigencore/Arena.cpp b/sigencore/Arena.cpp
index be3e0ffe..088c8349 100644
--- a/sigencore/Arena.cpp
+++ b/sigencore/Arena.cpp
@@ -210,13 +210,17 @@ Sigscript::SigmodWrapper* Sigencore::Arena::sigmod() const
bool Sigencore::Arena::addClient(Client* client, const int team)
{
- if (((team < 0) || ((m_state == Setup) && qobject_cast<Player*>(client) && (active(Fighters).size() < m_sigmod->rules()->maxPlayers()))) && client->enterArena(this))
+ if (0 <= team)
{
- m_teams[client] = team;
- emit(clientAdded(client, team));
- return true;
+ Player* player = qobject_cast<Player*>(client);
+ if ((m_state != Setup) || !player || !isTeamAllowed(player->team()) || (active(Fighters).size() < m_sigmod->rules()->maxPlayers()))
+ return false;
}
- return false;
+ if (!client->enterArena(this))
+ return false;
+ m_teams[client] = team;
+ emit(clientAdded(client, team));
+ return true;
}
void Sigencore::Arena::removeClient(Client* client)