From 5e4ef80dc29a69e1f5f185d1efab323af4a77292 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Wed, 21 Nov 2012 20:49:58 +0000 Subject: Added get/set methods for the weapon-slot API. --- src/game/base/weapon.h | 80 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 74 insertions(+), 6 deletions(-) (limited to 'src/game/base/weapon.h') diff --git a/src/game/base/weapon.h b/src/game/base/weapon.h index ba28810..94fdce6 100644 --- a/src/game/base/weapon.h +++ b/src/game/base/weapon.h @@ -24,10 +24,14 @@ public: inline SubType subtype() const { return weapon_subtype; } + inline bool stackable() const { return weapon_stackable; } + /** + * @brief player level required to buy this weapon + * */ inline int level() const { return weapon_level; } @@ -39,23 +43,79 @@ public: { return weapon_damage; } - - /* --- mutators -------------------------------------------- */ - + /** - * @brief set the amount of damage this weapon inflicts + * @brief speed of projectiles generated by this weapon * */ - inline void set_damage(const float damage) + inline const float projectile_speed() const { - weapon_damage = damage; + return weapon_projectile_speed; } + /** + * @brief interval between consequtive projectils fired by this weapon, in milliseconds + * */ + inline const unsigned long projectile_interval() const + { + return weapon_projectile_interval; + } + + /** + * @brief name of the model used for projectiles generated by this weapon + * */ + inline const std::string & projectile_modelname() const + { + return weapon_projectile_modelname; + } + + /* --- mutators -------------------------------------------- */ + void set_stackable(bool stackable); void set_level(const int level); void set_subtype(const SubType subtype); + /** + * @brief set the projectile lifespan, in milliseconds + * */ + inline void set_projectile_lifespan(const unsigned long projectile_lifespan) + { + weapon_projectile_lifespan = projectile_lifespan; + } + + /** + * @brief set the interval between two consecutive shots by this weapon + * */ + inline void set_projectile_interval(const unsigned long projectile_interval) + { + weapon_projectile_interval = projectile_interval; + } + + /** + * @brief set_projectile speed, in game units per second + * */ + inline void set_projectile_speed(const float projectile_speed) + { + weapon_projectile_speed = projectile_speed; + } + + /** + * @brief set the amount of damage this weapon inflicts + * */ + inline void set_damage(const float damage) + { + weapon_damage = damage; + } + + /** + * @brief set_projectile model name + * */ + inline void set_projectile_modelname(const std::string & projectile_modelname) + { + weapon_projectile_modelname.assign(projectile_modelname); + } + /* --- static registry functions ---------------------------------- */ static Weapon *find(const std::string & label); @@ -79,7 +139,15 @@ private: bool weapon_stackable; + unsigned long weapon_projectile_interval; + + unsigned long weapon_projectile_lifespan; + + float weapon_projectile_speed; + float weapon_damage; + + std::string weapon_projectile_modelname; }; } // namespace game -- cgit v1.2.3