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>2010-11-25 22:09:19 +0000
committerStijn Buys <ingar@osirion.org>2010-11-25 22:09:19 +0000
commit5a31dc0d38408a9c9e3a7e82ad3f8cb4a3d02680 (patch)
tree8a1a24a2b16eb626a8f393fe65a5f418e86385a1
parentaae321e655a3590f81173b615cc1f227fdf996a7 (diff)
Corrected core::EntityControlable::control_flags network transmission.
-rw-r--r--src/core/entity.cc13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc
index d6b0a10..4c7b0da 100644
--- a/src/core/entity.cc
+++ b/src/core/entity.cc
@@ -785,16 +785,14 @@ void EntityControlable::receive_server_create(std::istream &is)
int owner_id = 0;
is >> owner_id;
- if (owner_id) {
- for (GameInterface::Players::iterator pit = game()->players().begin(); pit != game()->players().end(); pit++) {
+ if (owner_id && !owner()) {
+ for (GameInterface::Players::iterator pit = game()->players().begin();!owner() && (pit != game()->players().end()); pit++) {
Player *player = (*pit);
if (player->id() == owner_id) {
player->add_asset(this);
- entity_owner = player;
-
+ // entity_owner = player; // add_asset already sets this
}
}
-
if (!entity_owner) {
con_warn << "could not find owner " << owner_id << " for entity " << id() << "\n";
}
@@ -811,6 +809,7 @@ void EntityControlable::serialize_client_update(std::ostream & os) const
os << target_strafe << " ";
os << target_vstrafe << " ";
os << target_afterburner << " ";
+ os << entity_control_flags << " ";
}
void EntityControlable::receive_client_update(std::istream &is)
@@ -823,13 +822,13 @@ void EntityControlable::receive_client_update(std::istream &is)
is >> target_strafe;
is >> target_vstrafe;
is >> target_afterburner;
+ is >> entity_control_flags;
}
void EntityControlable::serialize_server_update(std::ostream & os) const
{
EntityDynamic::serialize_server_update(os);
os << roundf(entity_thrust * 100.0f) << " ";
- os << roundf(entity_control_flags) << " ";
}
void EntityControlable::receive_server_update(std::istream &is)
@@ -837,8 +836,6 @@ void EntityControlable::receive_server_update(std::istream &is)
EntityDynamic::receive_server_update(is);
is >> entity_thrust;
entity_thrust /= 100.0f;
-
- is >> entity_control_flags;
}
void EntityControlable::set_thrust(float thrust)