aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/cpp
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-02-17 22:08:18 +0100
committerNao Pross <naopross@thearcway.org>2018-02-17 22:08:18 +0100
commit7ec2e0fbd6c53faa52ca0e6f2e8e172d3556c81d (patch)
tree3ce33e8d1b83e3adf9b7998fbfc206014e9250e7 /src/main/cpp
parentAdd all warning and thread them as errors (diff)
downloadSubconscious-old-7ec2e0fbd6c53faa52ca0e6f2e8e172d3556c81d.tar.gz
Subconscious-old-7ec2e0fbd6c53faa52ca0e6f2e8e172d3556c81d.zip
Fix all warnings (errors with -Werror)
Diffstat (limited to '')
-rw-r--r--src/main/cpp/Bullet.cpp2
-rw-r--r--src/main/cpp/Map.cpp5
-rw-r--r--src/main/cpp/MeleeWeapon.cpp2
-rw-r--r--src/main/cpp/RangedWeapon.cpp9
-rw-r--r--src/main/cpp/Stick.cpp3
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;
}