From 7888930bf0a75999e103f7781c095e04b6860ee5 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 15 Nov 2009 15:35:59 +0000 Subject: added entity request network message --- src/core/entity.cc | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) (limited to 'src/core/entity.cc') diff --git a/src/core/entity.cc b/src/core/entity.cc index ece1e9b..aa9e45b 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -112,13 +112,13 @@ void Entity::list() /* ---- class Entity ----------------------------------------------- */ -Entity::Entity(const unsigned int flags) : +Entity::Entity() : entity_location(0.0f, 0.0f, 0.0f), entity_color(1.0f, 1.0f, 1.0f, 1.0f), entity_color_second(1.0f, 1.0f, 1.0f, 1.0f) { entity_id = 0; - entity_flags = flags; + entity_flags = 0; entity_moduletypeid = 0; entity_speed = 0.0f; @@ -391,15 +391,13 @@ void Entity::remove_menu(std::string const &label) /* ---- class EntityDynamic ---------------------------------------- */ -EntityDynamic::EntityDynamic(unsigned int flags) : - Entity(flags) +EntityDynamic::EntityDynamic() : Entity() { entity_state = Normal; entity_timer = 0; } -EntityDynamic::EntityDynamic(std::istream & is) : - Entity(is) +EntityDynamic::EntityDynamic(std::istream & is) : Entity(is) { entity_state = Normal; entity_timer = 0; @@ -507,8 +505,7 @@ void EntityDynamic::receive_server_update(std::istream &is) /*----- EntityControlable ------------------------------------------ */ -EntityControlable::EntityControlable(Player *owner, unsigned int flags) : - EntityDynamic(flags) +EntityControlable::EntityControlable() : EntityDynamic() { entity_thrust = 0; entity_movement = 0; @@ -521,8 +518,6 @@ EntityControlable::EntityControlable(Player *owner, unsigned int flags) : target_afterburner = 0.0f; entity_owner = 0; - if (owner) - owner->add_asset(this); } EntityControlable::EntityControlable(std::istream & is) : @@ -548,6 +543,18 @@ EntityControlable::~EntityControlable() entity_owner->remove_asset(this); } +void EntityControlable::set_owner(Player *owner) +{ + if (entity_owner) + entity_owner->remove_asset(this); + + entity_owner = owner; + + if (entity_owner) + entity_owner->add_asset(this); + +} + void EntityControlable::serialize_server_create(std::ostream & os) const { EntityDynamic::serialize_server_create(os); @@ -696,16 +703,14 @@ void EntityControlable::set_afterburner(float afterburner) /*----- EntityGlobe ------------------------------------------------ */ -EntityGlobe::EntityGlobe(unsigned int flags) : - Entity(flags) +EntityGlobe::EntityGlobe() : Entity() { render_texture = 0; entity_rotationspeed = 0; entity_shape = Sphere; } -EntityGlobe::EntityGlobe(std::istream & is) : - Entity(is) +EntityGlobe::EntityGlobe(std::istream & is) : Entity(is) { render_texture = 0; entity_rotationspeed = 0; -- cgit v1.2.3