aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/cpp/RangedWeapon.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/cpp/RangedWeapon.cpp')
-rw-r--r--src/main/cpp/RangedWeapon.cpp29
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;
+ }
+ */
+
}