From ca0c1d3e6f8b5fa4eb2e0a86fcf47b12fb600786 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 27 Sep 2008 17:16:15 +0000 Subject: mission targets, texture unloading, private messages --- src/core/player.cc | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'src/core/player.cc') diff --git a/src/core/player.cc b/src/core/player.cc index 1a610ca..26ea070 100644 --- a/src/core/player.cc +++ b/src/core/player.cc @@ -6,6 +6,7 @@ #include +#include "auxiliary/functions.h" #include "sys/sys.h" #include "core/player.h" #include "core/cvar.h" @@ -33,6 +34,7 @@ void Player::clear() player_zonechange = false; player_rcon = false; player_mute = false; + player_mission_target = 0; clear_assets(); player_control = 0; @@ -56,12 +58,23 @@ void Player::set_zone(Zone *zone) } } +void Player::set_mission_target(Entity *new_mission_target) +{ + if (new_mission_target != player_mission_target) { + player_mission_target = new_mission_target; + player_dirty = true; + } +} + void Player::update_info() { Cvar *cl_name = Cvar::find("cl_name"); if (cl_name) { - if (cl_name->str().size()) + if (cl_name->str().size()) { player_name = cl_name->str(); + aux::strip_quotes(player_name); + (*cl_name) = player_name; + } } Cvar *cl_color = Cvar::find("cl_color"); @@ -105,8 +118,9 @@ void Player::serialize_server_update(std::ostream & os) const { unsigned int zo = (zone() ? zone()->id() : 0); unsigned int co = (player_control ? player_control->id() : 0); + unsigned int mission = (player_mission_target ? player_mission_target->id() : 0); - os << player_id << " " << zo << " " << co << " " << player_color << " \"" << player_name << "\""; + os << player_id << " " << zo << " " << co << " " << mission << " " << player_color << " \"" << player_name << "\""; } void Player::receive_server_update(std::istream &is) @@ -131,6 +145,16 @@ void Player::receive_server_update(std::istream &is) player_control = 0; } + unsigned int mission = 0; + is >> mission; + if (mission) { + player_mission_target = Entity::find(mission); + if (!player_mission_target) { + con_warn << "mission target set to unknown entity " << co << "\n"; + } + } else { + player_mission_target = 0; + } is >> player_color; std::string n; -- cgit v1.2.3