diff --git a/source/Game.cpp b/source/Game.cpp index d423f87..3577650 100644 --- a/source/Game.cpp +++ b/source/Game.cpp @@ -12,7 +12,8 @@ #include #include "abstract/Character.h" -#include "sprites/Enemy.h" +#include "sprites/Enemy.h" +#include "sprites/Player.h" #include "util/Loader.h" #include "util/ResourceManager.h" #include "util/Yaml.h" diff --git a/source/Game.h b/source/Game.h index e997bcf..8fd86e0 100644 --- a/source/Game.h +++ b/source/Game.h @@ -8,15 +8,7 @@ #ifndef DG_GAME_H_ #define DG_GAME_H_ -#include - -#include -#include - -#include - #include "sprites/TileManager.h" -#include "sprites/Player.h" #include "World.h" class TileManager; diff --git a/source/World.h b/source/World.h index 973f210..35a7b83 100755 --- a/source/World.h +++ b/source/World.h @@ -8,8 +8,8 @@ #ifndef DG_WORLD_H_ #define DG_WORLD_H_ -#include "abstract/Sprite.h" #include "abstract/Character.h" +#include "abstract/Sprite.h" class Character; class Sprite; diff --git a/source/abstract/Character.cpp b/source/abstract/Character.cpp index fc63a26..692e572 100644 --- a/source/abstract/Character.cpp +++ b/source/abstract/Character.cpp @@ -16,6 +16,7 @@ #include "../sprites/Corpse.h" #include "../util/Log.h" #include "../util/Yaml.h" +#include "../World.h" const std::string Character::KEY_HEALTH = "health"; const int Character::DEFAULT_HEALTH = 100; diff --git a/source/abstract/Character.h b/source/abstract/Character.h index 332c54a..7b73e64 100644 --- a/source/abstract/Character.h +++ b/source/abstract/Character.h @@ -8,14 +8,10 @@ #ifndef DG_ACTOR_H_ #define DG_ACTOR_H_ -#include -#include - #include "Sprite.h" class World; class Weapon; -class Sprite; class Yaml; /** diff --git a/source/abstract/Singleton.h b/source/abstract/Singleton.h index e275ca4..0bd8fb7 100644 --- a/source/abstract/Singleton.h +++ b/source/abstract/Singleton.h @@ -8,8 +8,6 @@ #ifndef DG_SINGLETON_H_ #define DG_SINGLETON_H_ -#include - /** * Template class for inheriting singleton behaviour. * diff --git a/source/effects/Bullet.cpp b/source/effects/Bullet.cpp index 9b646fa..31d496a 100755 --- a/source/effects/Bullet.cpp +++ b/source/effects/Bullet.cpp @@ -12,6 +12,7 @@ #include "../abstract/Character.h" #include "../util/Loader.h" #include "../util/ResourceManager.h" +#include "../util/Yaml.h" const std::string Bullet::KEY_DAMAGE = "damage"; const int Bullet::DEFAULT_DAMAGE = 10; diff --git a/source/effects/Bullet.h b/source/effects/Bullet.h index 3a70a0e..57d3c1d 100755 --- a/source/effects/Bullet.h +++ b/source/effects/Bullet.h @@ -8,12 +8,8 @@ #ifndef DG_BULLET_H_ #define DG_BULLET_H_ -#include - #include "../particle/Particle.h" -#include "../util/Yaml.h" -class Particle; class Yaml; /** diff --git a/source/items/Weapon.cpp b/source/items/Weapon.cpp index d93c1b0..eaadea5 100755 --- a/source/items/Weapon.cpp +++ b/source/items/Weapon.cpp @@ -13,6 +13,7 @@ #include "../World.h" #include "../effects/Bullet.h" +#include "../util/Yaml.h" const std::string Weapon::KEY_BULLET = "bullet"; const std::string Weapon::DEFAULT_BULLET = "bullet.yaml"; @@ -78,11 +79,11 @@ Weapon::onThink(int elapsed) { } } -std::shared_ptr +std::shared_ptr Weapon::createParticle() { // Minus to account for positive y-axis going downwards in SFML. sf::Vector2f offset(- mOffset); thor::rotate(offset, mHolder.getAngle()); - return std::shared_ptr(new Bullet(mHolder.getPosition() + offset, + return std::shared_ptr(new Bullet(mHolder.getPosition() + offset, mHolder, mHolder.getAngle(), Yaml(mBullet))); } diff --git a/source/items/Weapon.h b/source/items/Weapon.h index e8720b9..3179b89 100755 --- a/source/items/Weapon.h +++ b/source/items/Weapon.h @@ -8,7 +8,9 @@ #ifndef DG_WEAPON_H_ #define DG_WEAPON_H_ -#include +#include + +#include #include "../particle/Emitter.h" @@ -33,7 +35,7 @@ public: // Protected functions. protected: - std::shared_ptr createParticle(); + std::shared_ptr createParticle(); // Private variables. private: diff --git a/source/particle/Emitter.cpp b/source/particle/Emitter.cpp index 6118a8a..542787a 100755 --- a/source/particle/Emitter.cpp +++ b/source/particle/Emitter.cpp @@ -7,8 +7,10 @@ #include "Emitter.h" -Emitter::Emitter(World& collection) : - mCollection(collection) { +#include "../World.h" + +Emitter::Emitter(World& world) : + mWorld(world) { } Emitter::~Emitter() { @@ -19,5 +21,5 @@ Emitter::~Emitter() { */ void Emitter::emit() { - mCollection.insert(createParticle()); + mWorld.insert(createParticle()); } diff --git a/source/particle/Emitter.h b/source/particle/Emitter.h index e25fad8..f96de2f 100755 --- a/source/particle/Emitter.h +++ b/source/particle/Emitter.h @@ -8,27 +8,27 @@ #ifndef DG_EMITTER_H_ #define DG_EMITTER_H_ -#include "../World.h" -#include "Particle.h" +#include class World; class Particle; +class Sprite; class Emitter { // Public functions. public: - Emitter(World& collection); + Emitter(World& world); virtual ~Emitter(); // Protected functions. protected: void emit(); /// Creates a particle. Allows to use a user-defined particle class and custom settings. - virtual std::shared_ptr createParticle() = 0; + virtual std::shared_ptr createParticle() = 0; // Private variables. private: - World& mCollection; + World& mWorld; }; #endif /* DG_EMITTER_H_ */ diff --git a/source/particle/Particle.h b/source/particle/Particle.h index 3612b0c..6639b1d 100755 --- a/source/particle/Particle.h +++ b/source/particle/Particle.h @@ -9,9 +9,7 @@ #define DG_PARTICLE_H_ #include "../abstract/Sprite.h" -#include "../util/Yaml.h" -class Sprite; class Yaml; /** diff --git a/source/sprites/Corpse.h b/source/sprites/Corpse.h index c67e5cf..e82c970 100644 --- a/source/sprites/Corpse.h +++ b/source/sprites/Corpse.h @@ -10,7 +10,6 @@ #include "../abstract/Sprite.h" -class Sprite; class Yaml; class Corpse : public Sprite { diff --git a/source/sprites/Enemy.h b/source/sprites/Enemy.h index c813283..8d2c57d 100644 --- a/source/sprites/Enemy.h +++ b/source/sprites/Enemy.h @@ -10,7 +10,6 @@ #include "../abstract/Character.h" -class Character; class World; class Yaml; diff --git a/source/sprites/Player.h b/source/sprites/Player.h index b0e2dfd..4569e9e 100644 --- a/source/sprites/Player.h +++ b/source/sprites/Player.h @@ -8,13 +8,10 @@ #ifndef DG_PLAYER_H_ #define DG_PLAYER_H_ -#include -#include - #include "../abstract/Character.h" -class Character; class Yaml; +class World; /** * Player object. diff --git a/source/sprites/TileManager.cpp b/source/sprites/TileManager.cpp index bf1f4bd..e69382a 100644 --- a/source/sprites/TileManager.cpp +++ b/source/sprites/TileManager.cpp @@ -16,6 +16,7 @@ #include "../util/Loader.h" #include "../util/ResourceManager.h" #include "../util/Yaml.h" +#include "../World.h" const sf::Vector2i TileManager::TILE_SIZE = sf::Vector2i(100, 100); diff --git a/source/sprites/TileManager.h b/source/sprites/TileManager.h index 78e68c8..0bf66c1 100644 --- a/source/sprites/TileManager.h +++ b/source/sprites/TileManager.h @@ -8,15 +8,9 @@ #ifndef DG_TILEMANAGER_H_ #define DG_TILEMANAGER_H_ -#include -#include - -#include "../World.h" #include "../abstract/Sprite.h" -#include class World; -class Sprite; class TileManager : public sf::Drawable { // Public types. diff --git a/source/util/Loader.h b/source/util/Loader.h index b4801ae..fe29035 100755 --- a/source/util/Loader.h +++ b/source/util/Loader.h @@ -8,19 +8,10 @@ #ifndef DG_LOADER_H_ #define DG_LOADER_H_ -#include -#include -#include - -#include - #include #include "../abstract/Singleton.h" -template -class Singleton; - /** * This class allows to set default resource folders and subfolders, which means that these * folders only have to be set once, and not be included in the creation of every single diff --git a/source/util/Log.h b/source/util/Log.h index f364eea..f4d00bf 100644 --- a/source/util/Log.h +++ b/source/util/Log.h @@ -8,8 +8,6 @@ #ifndef DG_LOG_H_ #define DG_LOG_H_ -#include - /** * Logging functions for different levels. * diff --git a/source/util/ResourceManager.h b/source/util/ResourceManager.h index aa5743d..38d50a9 100644 --- a/source/util/ResourceManager.h +++ b/source/util/ResourceManager.h @@ -8,15 +8,8 @@ #ifndef DG_RESOURCEMANAGER_H_ #define DG_RESOURCEMANAGER_H_ -#include - -#include - #include "../abstract/Singleton.h" -template -class Singleton; - /** * Loads and manages all resources by providing Singleton access to Thor ResourceManager. */