From a8078dc796e94f4042905732b9e24253dae9347a Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Sun, 18 Nov 2012 17:08:42 +0000 Subject: Added support for projectile ownerid. --- src/game/base/projectile.cc | 1 + src/game/base/projectile.h | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src/game/base') diff --git a/src/game/base/projectile.cc b/src/game/base/projectile.cc index b80d7a6..6bcbad9 100644 --- a/src/game/base/projectile.cc +++ b/src/game/base/projectile.cc @@ -33,6 +33,7 @@ Projectile::Projectile(unsigned long lifespan) : EntityDynamic() projectile_damage = 0.0f; projectile_lifespan = lifespan; projectile_timestamp = core::server()->timestamp(); + projectile_ownerid = 0; } Projectile::~Projectile() diff --git a/src/game/base/projectile.h b/src/game/base/projectile.h index 238de6a..877632f 100644 --- a/src/game/base/projectile.h +++ b/src/game/base/projectile.h @@ -47,6 +47,14 @@ public: return projectile_damage; } + /** + * @brief id of the player who fired the projectile + * */ + inline const int ownerid() const + { + return projectile_ownerid; + } + /* --- mutators -------------------------------------------- */ /** @@ -55,7 +63,12 @@ public: inline void set_damage(const float damage) { projectile_damage = damage; - } + } + + inline void set_ownerid(const int ownerid) + { + projectile_ownerid = ownerid; + } private: unsigned long projectile_timestamp; @@ -63,6 +76,8 @@ private: unsigned long projectile_lifespan; float projectile_damage; + + int projectile_ownerid; }; } // namespace game -- cgit v1.2.3