aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/headers
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2018-02-12 20:33:48 +0100
committerNao Pross <naopross@thearcway.org>2018-02-12 20:33:48 +0100
commit92bec13dec53933a9cf8045ab486b47dc13fe46f (patch)
treede140535d5e6941bfd0f251e851f8a331ce6edf2 /src/main/headers
parentFix pan (diff)
downloadSubconscious-old-92bec13dec53933a9cf8045ab486b47dc13fe46f.tar.gz
Subconscious-old-92bec13dec53933a9cf8045ab486b47dc13fe46f.zip
Remove Actor::Type and Scene::Type in favor of dynamic_cast<T>()
Diffstat (limited to '')
-rw-r--r--src/main/headers/Actor.hpp15
-rw-r--r--src/main/headers/Scene.hpp9
2 files changed, 6 insertions, 18 deletions
diff --git a/src/main/headers/Actor.hpp b/src/main/headers/Actor.hpp
index 7cc3be5..0e74ee0 100644
--- a/src/main/headers/Actor.hpp
+++ b/src/main/headers/Actor.hpp
@@ -1,29 +1,22 @@
#ifndef ACTOR_HPP
#define ACTOR_HPP
+#include <vector>
#include <string>
+
class Actor
{
public:
- const enum Type
- {
- PLAYER, ENEMY
- } type;
-
const unsigned maxHp;
const std::string name;
Actor() = delete;
- Actor(std::string _name, unsigned _maxHp, Type _type);
virtual ~Actor();
void damage(int amt);
void heal(int amt);
- // TODO shouldnt be done by the map ?
- // bool move(int x, y);
-
/* accessors */
bool alive() { return _alive; }
unsigned hp() { return _hp; }
@@ -31,10 +24,12 @@ public:
int x() { return _x; }
int y() { return _y; }
-private:
+protected:
bool _alive;
unsigned _hp;
int _x, _y;
+
+ Actor(std::string _name, unsigned _maxHp);
};
#endif
diff --git a/src/main/headers/Scene.hpp b/src/main/headers/Scene.hpp
index 2183d63..2d720a9 100644
--- a/src/main/headers/Scene.hpp
+++ b/src/main/headers/Scene.hpp
@@ -6,13 +6,6 @@
class Scene
{
public:
- enum Type
- {
- WORLD, MENU
- };
-
- const Type type;
-
Scene() = delete;
virtual void render() = 0;
@@ -25,7 +18,7 @@ protected:
float _zoom = 1;
sf::RenderWindow &_window;
- Scene(sf::RenderWindow &window, Type _type) : type(_type), _window(window) {}
+ Scene(sf::RenderWindow &window) : _window(window) {}
};
#endif