diff options
| author | Alfred Eriksson <somerunce@gmail.com> | 2008-09-07 08:10:56 +0000 |
|---|---|---|
| committer | Alfred Eriksson <somerunce@gmail.com> | 2008-09-07 08:10:56 +0000 |
| commit | 6dcea2c4ca59e0f1ac8450cc31550bdb35bc21b1 (patch) | |
| tree | 52d63fa64e79123e34e19c15819dbd0fb889abc4 /src/game/server/hooks.cpp | |
| parent | 4fb71c1bca5b5acd86f8ef92441ff687679a95a7 (diff) | |
| download | zcatch-6dcea2c4ca59e0f1ac8450cc31550bdb35bc21b1.tar.gz zcatch-6dcea2c4ca59e0f1ac8450cc31550bdb35bc21b1.zip | |
mermerge from 0.4.3: auto team balancing
Diffstat (limited to 'src/game/server/hooks.cpp')
| -rw-r--r-- | src/game/server/hooks.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/game/server/hooks.cpp b/src/game/server/hooks.cpp index 773203bd..8688df28 100644 --- a/src/game/server/hooks.cpp +++ b/src/game/server/hooks.cpp @@ -104,6 +104,8 @@ void mods_connected(int client_id) game.players[client_id].team = -1; else game.players[client_id].team = game.controller->get_auto_team(client_id); + + (void) game.controller->check_team_balance(); // send motd NETMSG_SV_MOTD msg; @@ -115,7 +117,7 @@ void mods_connected(int client_id) void mods_client_drop(int client_id) { game.players[client_id].on_disconnect(); - + (void) game.controller->check_team_balance(); } void mods_message(int msgtype, int client_id) @@ -156,7 +158,15 @@ void mods_message(int msgtype, int client_id) // Switch team on given client and kill/respawn him if(game.controller->can_join_team(msg->team, client_id)) - p->set_team(msg->team); + { + if(game.controller->can_change_team(p, msg->team)) + { + p->set_team(msg->team); + (void) game.controller->check_team_balance(); + } + else + game.send_broadcast("Teams must be balanced, please join other team", client_id); + } else { char buf[128]; |