aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/cpp')
-rw-r--r--src/main/cpp/Actor.cpp4
-rw-r--r--src/main/cpp/Subconscious.cpp21
-rw-r--r--src/main/cpp/WorldScene.cpp2
3 files changed, 13 insertions, 14 deletions
diff --git a/src/main/cpp/Actor.cpp b/src/main/cpp/Actor.cpp
index 219488d..a6dc597 100644
--- a/src/main/cpp/Actor.cpp
+++ b/src/main/cpp/Actor.cpp
@@ -1,7 +1,7 @@
#include "Actor.hpp"
-Actor::Actor(std::string _name, unsigned _maxHp, Type _type) :
- name(_name), maxHp(_maxHp), type(_type)
+Actor::Actor(std::string _name, unsigned _maxHp) :
+ name(_name), maxHp(_maxHp)
{}
Actor::~Actor()
diff --git a/src/main/cpp/Subconscious.cpp b/src/main/cpp/Subconscious.cpp
index a5f8620..5d04e5c 100644
--- a/src/main/cpp/Subconscious.cpp
+++ b/src/main/cpp/Subconscious.cpp
@@ -34,26 +34,26 @@ void Subconscious::run()
case sf::Event::KeyPressed:
switch (event.key.code) {
case sf::Keyboard::Up:
- if (_currentScene->type == Scene::Type::WORLD) {
- static_cast<WorldScene*>(_currentScene)->pan(0, -10);
+ if (WorldScene *worldScene = dynamic_cast<WorldScene*>(_currentScene)) {
+ worldScene->pan(0, -10);
}
break;
case sf::Keyboard::Down:
- if (_currentScene->type == Scene::Type::WORLD) {
- static_cast<WorldScene*>(_currentScene)->pan(0, 10);
+ if (WorldScene *worldScene = dynamic_cast<WorldScene*>(_currentScene)) {
+ worldScene->pan(0, 10);
}
break;
case sf::Keyboard::Left:
- if (_currentScene->type == Scene::Type::WORLD) {
- static_cast<WorldScene*>(_currentScene)->pan(-10, 0);
+ if (WorldScene *worldScene = dynamic_cast<WorldScene*>(_currentScene)) {
+ worldScene->pan(-10, 0);
}
break;
case sf::Keyboard::Right:
- if (_currentScene->type == Scene::Type::WORLD) {
- static_cast<WorldScene*>(_currentScene)->pan(10, 0);
+ if (WorldScene *worldScene = dynamic_cast<WorldScene*>(_currentScene)) {
+ worldScene->pan(10, 0);
}
break;
@@ -83,9 +83,8 @@ void Subconscious::run()
//
// std::cout << std::fixed << std::setprecision(3)
// << event.mouseWheelScroll.delta << std::endl;
-
- if (_currentScene->type == Scene::Type::WORLD) {
- static_cast<WorldScene*>(_currentScene)->zoom(event.mouseWheelScroll.delta/10.0);
+ if (WorldScene *worldScene = dynamic_cast<WorldScene*>(_currentScene)) {
+ worldScene->zoom(event.mouseWheelScroll.delta/10.0);
}
break;
diff --git a/src/main/cpp/WorldScene.cpp b/src/main/cpp/WorldScene.cpp
index 1be2097..8887f6f 100644
--- a/src/main/cpp/WorldScene.cpp
+++ b/src/main/cpp/WorldScene.cpp
@@ -1,6 +1,6 @@
#include "WorldScene.hpp"
-WorldScene::WorldScene(sf::RenderWindow &window) : Scene(window, Scene::Type::WORLD)
+WorldScene::WorldScene(sf::RenderWindow &window) : Scene(window)
{
_tileSize = DEFAULT_TILE_SIZE_PX;
}