diff options
author | Stijn Buys <ingar@osirion.org> | 2012-04-22 19:48:27 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2012-04-22 19:48:27 +0000 |
commit | 8f124fabdfd6761cefbcc2c4120ba325692f5d0b (patch) | |
tree | 21d38bdc6088654802d736dcb905429c42bd591a /src/core/entity.cc | |
parent | d1931b1ebbe79cbd0f41290acbf9cb6d4c462878 (diff) |
Initial support for per-entity weapon slots.
Diffstat (limited to 'src/core/entity.cc')
-rw-r--r-- | src/core/entity.cc | 39 |
1 files changed, 34 insertions, 5 deletions
diff --git a/src/core/entity.cc b/src/core/entity.cc index 2f23444..3094208 100644 --- a/src/core/entity.cc +++ b/src/core/entity.cc @@ -168,6 +168,7 @@ Entity::Entity() : entity_serverside = false; entity_inventory = 0; + entity_slots = 0; entity_info = 0; memset(entity_extension, 0, sizeof(entity_extension)); @@ -195,10 +196,9 @@ Entity::Entity(std::istream & is) entity_destroyed = false; entity_inventory = 0; + entity_slots = 0; entity_info = 0; - entity_inventory = 0; - memset(entity_extension, 0, sizeof(entity_extension)); } @@ -218,10 +218,17 @@ Entity::~Entity() } menus().clear(); + // delete equipment slots + if (entity_slots) { + delete entity_slots; + } + // delete inventory - if (entity_inventory) + if (entity_inventory) { delete entity_inventory; + } + // remove entity from zone if (entity_zone) { entity_zone->remove(this); @@ -230,22 +237,28 @@ Entity::~Entity() } } + // delete collision shape if (entity_collision_shape) { delete entity_collision_shape; entity_collision_shape = 0; } + // delete child collision shapes for (CollisionShapes::iterator sit = entity_collision_child_shapes.begin(); sit != entity_collision_child_shapes.end(); sit++) { delete (*sit); (*sit) = 0; } entity_collision_child_shapes.clear(); - if (entity_body) + // delete collision body + if (entity_body) { delete entity_body; + } - if (entity_body_info) + // delete collision body construction information + if (entity_body_info) { delete entity_body_info; + } } void Entity::die() @@ -279,6 +292,14 @@ Inventory *Entity::add_inventory() return(entity_inventory); } +Slots *Entity::add_slots() +{ + if (!entity_slots) { + entity_slots = new Slots(); + } + return entity_slots; +} + void Entity::set_zone(Zone *zone) { if (entity_zone == zone) @@ -1100,6 +1121,14 @@ void EntityControlable::set_vstrafe(float vstrafe) } } +void EntityControlable::set_target_aim(const math::Vector3f &aim) +{ + if (aim != target_aim) { + target_aim.assign(aim); + set_dirty(); + } +} + void EntityControlable::set_afterburner(float afterburner) { if (target_afterburner != afterburner) { |