From 93dd038acea20774143dde34bd924f6eb0d3568a Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sat, 29 Dec 2012 23:23:44 +0000 Subject: Added sound effects for weapon mounting and target hitting, enabled projectile soundname transfer in networked games, resolved an issue where a ship was able to shoot itself, bumped network protocol to 26, --- src/core/entityprojectile.h | 44 +++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-) (limited to 'src/core/entityprojectile.h') diff --git a/src/core/entityprojectile.h b/src/core/entityprojectile.h index cfd534b..2651203 100644 --- a/src/core/entityprojectile.h +++ b/src/core/entityprojectile.h @@ -15,7 +15,7 @@ namespace core class EntityProjectile : public core::EntityDynamic { public: - EntityProjectile(); + EntityProjectile(const Entity *spawn = 0); EntityProjectile(std::istream & is); virtual ~EntityProjectile(); @@ -59,9 +59,17 @@ public: /** * @brief id of the player who fired the projectile * */ - inline const unsigned int ownerid() const + inline const int owner_id() const { - return projectile_ownerid; + return projectile_owner_id; + } + + /** + * @brief id of the entity that spawned the projectile + * */ + inline const unsigned int spawn_id() const + { + return projectile_spawn_id; } /** @@ -115,14 +123,6 @@ public: projectile_lifespan = lifespan; } - /** - * @brief set the id of the player who fired the projectile - * */ - inline void set_ownerid(const unsigned int ownerid) - { - projectile_ownerid = ownerid; - } - /** * @brief set the projectile timestamp * */ @@ -141,18 +141,24 @@ public: * */ void set_projectile_soundname(const std::string soundname); -private: - unsigned long projectile_timestamp; - - unsigned long projectile_lifespan; + /** + * @brief set the entity that spawned the projectile + * This sets spawn_id() to the id of the entity and owner_id() to the id + * of the owner of the spawn, if any. + * */ + void set_spawn(const Entity *spawn); - std::string projectile_modelname_str; +private: + unsigned long projectile_timestamp; + unsigned long projectile_lifespan; - std::string projectile_soundname_str; + std::string projectile_modelname_str; + std::string projectile_soundname_str; - float projectile_damage; + float projectile_damage; - unsigned int projectile_ownerid; + int projectile_owner_id; + unsigned int projectile_spawn_id; }; } // namespace game -- cgit v1.2.3