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>2012-12-29 23:23:44 +0000
committerStijn Buys <ingar@osirion.org>2012-12-29 23:23:44 +0000
commit93dd038acea20774143dde34bd924f6eb0d3568a (patch)
treec357b11eeb6eb455543180ea30fa04f2054ac0d4 /src/core/entityprojectile.h
parent962a744f6782fbcfadf7771ceb157bd82f369ab3 (diff)
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,
Diffstat (limited to 'src/core/entityprojectile.h')
-rw-r--r--src/core/entityprojectile.h44
1 files changed, 25 insertions, 19 deletions
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;
}
/**
@@ -116,14 +124,6 @@ public:
}
/**
- * @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
* */
inline void set_timestamp(const unsigned int 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