Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-09-27 17:16:15 +0000
committerStijn Buys <ingar@osirion.org>2008-09-27 17:16:15 +0000
commitca0c1d3e6f8b5fa4eb2e0a86fcf47b12fb600786 (patch)
tree5d72e330f11350065806e83cc8712693241b9aad /src/core/player.cc
parent29984680d6e0e52efec489497b1796e056164442 (diff)
mission targets, texture unloading, private messages
Diffstat (limited to 'src/core/player.cc')
-rw-r--r--src/core/player.cc28
1 files changed, 26 insertions, 2 deletions
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 <sstream>
+#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;