Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/player.cc')
-rw-r--r--src/core/player.cc33
1 files changed, 29 insertions, 4 deletions
diff --git a/src/core/player.cc b/src/core/player.cc
index bf71b77..14767bd 100644
--- a/src/core/player.cc
+++ b/src/core/player.cc
@@ -38,6 +38,7 @@ void Player::clear()
player_zonechange = false;
player_mute = false;
player_mission_target = 0;
+ player_autopilot_target = 0;
player_view = 0;
clear_assets();
@@ -146,6 +147,14 @@ void Player::set_mission_target(Entity *new_mission_target)
}
}
+void Player::set_autopilot_target(Entity *new_autopilot_target)
+{
+ if (new_autopilot_target != player_autopilot_target) {
+ player_autopilot_target = new_autopilot_target;
+ player_dirty = true;
+ }
+}
+
void Player::set_credits(const long amount)
{
player_credits = amount;
@@ -260,16 +269,18 @@ void Player::receive_client_update(std::istream &is)
void Player::serialize_server_update(std::ostream & os) const
{
- unsigned int zone_id = (zone() ? zone()->id() : 0);
- unsigned int view_id = (player_view ? player_view->id() : 0);
- unsigned int control_id = (player_control ? player_control->id() : 0);
- unsigned int mission_id = (player_mission_target ? player_mission_target->id() : 0);
+ const unsigned int zone_id = (zone() ? zone()->id() : 0);
+ const unsigned int view_id = (player_view ? player_view->id() : 0);
+ const unsigned int control_id = (player_control ? player_control->id() : 0);
+ const unsigned int mission_id = (player_mission_target ? player_mission_target->id() : 0);
+ const unsigned int autopilot_id = (player_autopilot_target ? player_autopilot_target->id() : 0);
os << player_id << " "
<< zone_id << " "
<< view_id << " "
<< control_id << " "
<< mission_id << " "
+ << autopilot_id << " "
<< player_credits << " "
<< player_level << " "
<< player_npckills << " "
@@ -307,6 +318,7 @@ void Player::receive_server_update(std::istream &is)
} else {
player_control = 0;
con_warn << "control set to unknown entity " << control_id << "\n";
+ // FIMXE request entity
}
} else {
player_control = 0;
@@ -318,10 +330,23 @@ void Player::receive_server_update(std::istream &is)
player_mission_target = Entity::find(mission_id);
if (!player_mission_target) {
con_warn << "mission target set to unknown entity " << mission_id << "\n";
+ // FIMXE request entity
}
} else {
player_mission_target = 0;
}
+
+ unsigned int autopilot_id = 0;
+ is >> autopilot_id;
+ if (autopilot_id) {
+ player_autopilot_target = Entity::find(autopilot_id);
+ if (!player_autopilot_target) {
+ con_warn << "autopilot target set to unknown entity " << autopilot_id << "\n";
+ // FIMXE request entity
+ }
+ } else {
+ player_autopilot_target = 0;
+ }
is >> player_credits;
is >> player_level;