From dbb28ef3422bf2442e15d75fd52180cfb9b40102 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 8 Nov 2008 12:58:05 +0000 Subject: adds rcon, rconpassword and sv_password --- src/core/player.cc | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'src/core/player.cc') diff --git a/src/core/player.cc b/src/core/player.cc index f5f28bd..865c859 100644 --- a/src/core/player.cc +++ b/src/core/player.cc @@ -32,7 +32,6 @@ void Player::clear() player_name.clear(); player_dirty = false; player_zonechange = false; - player_rcon = false; player_mute = false; player_mission_target = 0; player_view = 0; @@ -103,11 +102,22 @@ void Player::update_info() if (is >> color_second) player_color_second.assign(color_second); } + + Cvar *passwd = Cvar::find("rconpassword"); + if (passwd) { + player_rconpassword.assign(passwd->str()); + } else { + player_rconpassword.clear(); + } } void Player::serialize_client_update(std::ostream & os) { - os << " " << player_color << " " << player_color_second << " \"" << player_name << "\""; + os << player_color << " " + << player_color_second << " " + << "\"" << player_name << "\" " + << "\"" << player_rconpassword << "\""; + } void Player::receive_client_update(std::istream &is) @@ -122,7 +132,15 @@ void Player::receive_client_update(std::istream &is) n += c; if (n.size()) - player_name = n; + player_name.assign(n); + + n.clear(); + while ( (is.get(c)) && (c != '"')); + while ( (is.get(c)) && (c != '"')) + n += c; + + if (n.size()) + player_rconpassword.assign(n); } void Player::serialize_server_update(std::ostream & os) const -- cgit v1.2.3