diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-11-18 14:24:34 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-11-18 14:24:34 +0000 |
| commit | d4d1691fea007b04ad21686e8622efbbe53e9768 (patch) | |
| tree | 5f7fcde7a4a3ef5efb4c9c09835ba561e6b2337e /src/game/server | |
| parent | dda8f6b33ee05acdf23883c91a0897a464b84061 (diff) | |
| download | zcatch-d4d1691fea007b04ad21686e8622efbbe53e9768.tar.gz zcatch-d4d1691fea007b04ad21686e8622efbbe53e9768.zip | |
fixed so that the skins are sent over correctly and that team color overrides everything
Diffstat (limited to 'src/game/server')
| -rw-r--r-- | src/game/server/game_server.cpp | 35 | ||||
| -rw-r--r-- | src/game/server/srv_common.cpp | 17 | ||||
| -rw-r--r-- | src/game/server/srv_common.h | 6 |
3 files changed, 31 insertions, 27 deletions
diff --git a/src/game/server/game_server.cpp b/src/game/server/game_server.cpp index 06dafb72..9a02a95d 100644 --- a/src/game/server/game_server.cpp +++ b/src/game/server/game_server.cpp @@ -1520,7 +1520,9 @@ void send_info(int who, int to_who) msg_pack_int(who); msg_pack_string(server_clientname(who), 64); msg_pack_string(players[who].skin_name, 64); - msg_pack_int(players[who].skin_color); + msg_pack_int(players[who].use_custom_color); + msg_pack_int(players[who].color_body); + msg_pack_int(players[who].color_feet); msg_pack_end(); server_send_msg(to_who); } @@ -1550,34 +1552,13 @@ void mods_connected(int client_id) players[client_id].init(); players[client_id].client_id = client_id; - //dbg_msg("game", "join player='%d:%s'", client_id, server_clientname(client_id)); + //dbg_msg("game", "connected player='%d:%s'", client_id, server_clientname(client_id)); // Check which team the player should be on if(gameobj->gametype == GAMETYPE_DM) players[client_id].team = 0; else players[client_id].team = gameobj->getteam(client_id); - - // - /* - msg_pack_start(MSG_SETINFO, MSGFLAG_VITAL); - msg_pack_int(client_id); - msg_pack_string(server_clientname(client_id), 64); - msg_pack_end(); - server_send_msg(-1); - - for(int i = 0; i < MAX_CLIENTS; i++) - { - if(players[client_id].client_id != -1) - { - msg_pack_start(MSG_SETINFO, MSGFLAG_VITAL); - msg_pack_int(i); - msg_pack_string(server_clientname(i), 64); - msg_pack_end(); - server_send_msg(client_id); - } - }*/ - } void mods_client_drop(int client_id) @@ -1614,7 +1595,9 @@ void mods_message(int msg, int client_id) { const char *name = msg_unpack_string(); const char *skin_name = msg_unpack_string(); - int skin_color = msg_unpack_int(); + players[client_id].use_custom_color = msg_unpack_int(); + players[client_id].color_body = msg_unpack_int(); + players[client_id].color_feet = msg_unpack_int(); // check for invalid chars const char *p = name; @@ -1625,7 +1608,6 @@ void mods_message(int msg, int client_id) p++; } - // if(msg == MSG_CHANGEINFO && strcmp(name, server_clientname(client_id)) != 0) { @@ -1637,7 +1619,8 @@ void mods_message(int msg, int client_id) //send_set_name(client_id, players[client_id].name, name); strncpy(players[client_id].skin_name, skin_name, 64); server_setclientname(client_id, name); - players[client_id].skin_color = skin_color; + + gameobj->on_player_info_change(&players[client_id]); if(msg == MSG_STARTINFO) { diff --git a/src/game/server/srv_common.cpp b/src/game/server/srv_common.cpp index 638d31c6..c97433d3 100644 --- a/src/game/server/srv_common.cpp +++ b/src/game/server/srv_common.cpp @@ -110,6 +110,23 @@ void gameobject::post_reset() } } + + +void gameobject::on_player_info_change(class player *p) +{ + const int team_colors[2] = {54090, 10998628}; + if(is_teamplay) + { + if(p->team >= 0 || p->team <= 1) + { + p->use_custom_color = 1; + p->color_body = team_colors[p->team]; + p->color_feet = team_colors[p->team]; + } + } +} + + void gameobject::on_player_death(class player *victim, class player *killer, int weapon) { // do scoreing diff --git a/src/game/server/srv_common.h b/src/game/server/srv_common.h index 4b84b272..a780dd73 100644 --- a/src/game/server/srv_common.h +++ b/src/game/server/srv_common.h @@ -138,6 +138,8 @@ public: virtual void on_player_spawn(class player *p) {} virtual void on_player_death(class player *victim, class player *killer, int weapon); + virtual void on_player_info_change(class player *p); + virtual void snap(int snapping_client); virtual int getteam(int notthisid); }; @@ -241,7 +243,9 @@ public: // int client_id; char skin_name[64]; - int skin_color; + int use_custom_color; + int color_body; + int color_feet; // input player_input previnput; |