From 92bec13dec53933a9cf8045ab486b47dc13fe46f Mon Sep 17 00:00:00 2001 From: Nao Pross Date: Mon, 12 Feb 2018 20:33:48 +0100 Subject: Remove Actor::Type and Scene::Type in favor of dynamic_cast() --- src/main/headers/Actor.hpp | 15 +++++---------- src/main/headers/Scene.hpp | 9 +-------- 2 files changed, 6 insertions(+), 18 deletions(-) (limited to 'src/main/headers') 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 #include + 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 -- cgit v1.2.1