diff options
Diffstat (limited to 'src/main/cpp')
-rw-r--r-- | src/main/cpp/Bullet.cpp | 2 | ||||
-rw-r--r-- | src/main/cpp/Map.cpp | 5 | ||||
-rw-r--r-- | src/main/cpp/MeleeWeapon.cpp | 2 | ||||
-rw-r--r-- | src/main/cpp/RangedWeapon.cpp | 9 | ||||
-rw-r--r-- | src/main/cpp/Stick.cpp | 3 |
5 files changed, 16 insertions, 5 deletions
diff --git a/src/main/cpp/Bullet.cpp b/src/main/cpp/Bullet.cpp index c856213..412b5ef 100644 --- a/src/main/cpp/Bullet.cpp +++ b/src/main/cpp/Bullet.cpp @@ -1,6 +1,6 @@ #include "Bullet.hpp" -bool Bullet::decreaseAmount(int qnt) +bool Bullet::decreaseAmount(unsigned qnt) { if (_amount >= qnt) { _amount = _amount - qnt; diff --git a/src/main/cpp/Map.cpp b/src/main/cpp/Map.cpp index 3cb1b9d..d192b3b 100644 --- a/src/main/cpp/Map.cpp +++ b/src/main/cpp/Map.cpp @@ -24,6 +24,11 @@ const std::vector<Tile>& Map::tiles() const bool Map::moveActor(Tile &from, Tile &to) { + if (to.actor() != nullptr) + return false; + to.actor(from.actor()); from.clearActor(); + + return true; } diff --git a/src/main/cpp/MeleeWeapon.cpp b/src/main/cpp/MeleeWeapon.cpp index 8c7ffce..5dd0c0d 100644 --- a/src/main/cpp/MeleeWeapon.cpp +++ b/src/main/cpp/MeleeWeapon.cpp @@ -5,7 +5,7 @@ #include <string> MeleeWeapon::MeleeWeapon(Type t, const std::string &name, bool throwable) -: Weapon(Item::Type::MELEEWEAPON, name), type(t), _throwable(throwable) + : Weapon(Item::Type::MELEEWEAPON, name), type(t), _throwable(throwable) { } diff --git a/src/main/cpp/RangedWeapon.cpp b/src/main/cpp/RangedWeapon.cpp index 21feae4..6f24666 100644 --- a/src/main/cpp/RangedWeapon.cpp +++ b/src/main/cpp/RangedWeapon.cpp @@ -14,20 +14,25 @@ bool RangedWeapon::use(Actor &user, Actor &actor) actor.damage(user.attack() + _damage - actor.defence()); _charged = false; } + + return true; } bool RangedWeapon::reload(Actor &actor) { //TODO add bullet type std::list<Item*> inventory = actor.inventory(); - for (Item* item : inventory) { + for (Item *item : inventory) { if (item->type == Item::Type::BULLET) { //TODO get the bullet - //Bullet* bullet = dynamic_cast <Bullet*> (item); + // Bullet *bullet = dynamic_cast <Bullet*> (item); break; } } + // TODO remove + return true; + /* if (bullet->decreaseAmount(1)) { _charged = true; diff --git a/src/main/cpp/Stick.cpp b/src/main/cpp/Stick.cpp index bc67ccb..0dd7190 100644 --- a/src/main/cpp/Stick.cpp +++ b/src/main/cpp/Stick.cpp @@ -7,5 +7,6 @@ Stick::Stick(const std::string &name, int maxUses) : Item(Item::Type::STICK, nam bool Stick::use(Actor &user, Actor &actor) { - + // TODO remove placeholder + return true; } |