From 5a31dc0d38408a9c9e3a7e82ad3f8cb4a3d02680 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 25 Nov 2010 22:09:19 +0000 Subject: Corrected core::EntityControlable::control_flags network transmission. --- src/core/entity.cc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'src') 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) -- cgit v1.2.3