diff options
author | mafaldo <mafaldo@heavyhammer.home> | 2018-02-17 00:29:32 +0100 |
---|---|---|
committer | mafaldo <mafaldo@heavyhammer.home> | 2018-02-17 00:29:32 +0100 |
commit | af3e76c5ee367ceffb78fa4a8ffc0eadf90e5de3 (patch) | |
tree | 24dcdaa94c20211974fca97e41647ff0dec31923 /src/main/cpp/RangedWeapon.cpp | |
parent | Add cpack directive and update README (diff) | |
download | Subconscious-old-af3e76c5ee367ceffb78fa4a8ffc0eadf90e5de3.tar.gz Subconscious-old-af3e76c5ee367ceffb78fa4a8ffc0eadf90e5de3.zip |
add Item type, use for MeleeWeapon
Diffstat (limited to 'src/main/cpp/RangedWeapon.cpp')
-rw-r--r-- | src/main/cpp/RangedWeapon.cpp | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/src/main/cpp/RangedWeapon.cpp b/src/main/cpp/RangedWeapon.cpp index eb33780..21feae4 100644 --- a/src/main/cpp/RangedWeapon.cpp +++ b/src/main/cpp/RangedWeapon.cpp @@ -1,12 +1,9 @@ #include "RangedWeapon.hpp" #include "Actor.hpp" - -#include <string> -#include <algorithm> -#include <vector> +#include "Bullet.hpp" RangedWeapon::RangedWeapon(const std::string &name) -: Weapon(name) +: Weapon(Item::Type::RANGEDWEAPON, name) { } @@ -19,7 +16,25 @@ bool RangedWeapon::use(Actor &user, Actor &actor) } } -void RangedWeapon::reload(Actor &actor) +bool RangedWeapon::reload(Actor &actor) { - //std::vector<Item> bullet = actor.bullet(); + //TODO add bullet type + std::list<Item*> inventory = actor.inventory(); + for (Item* item : inventory) { + if (item->type == Item::Type::BULLET) { + //TODO get the bullet + //Bullet* bullet = dynamic_cast <Bullet*> (item); + break; + } + } + + /* + if (bullet->decreaseAmount(1)) { + _charged = true; + return true; + } else { + return false; + } + */ + } |