diff --git a/source/abstract/Sprite.cpp b/source/abstract/Sprite.cpp index 2b2c183..50e65e0 100755 --- a/source/abstract/Sprite.cpp +++ b/source/abstract/Sprite.cpp @@ -69,8 +69,8 @@ Sprite::~Sprite() { /** * Initializes container. */ -Sprite::Data::Data(const sf::Vector2f& position, const sf::Vector2f& direction, - Category category, unsigned short mask) : +Sprite::Data::Data(const sf::Vector2f& position, Category category, + unsigned short mask, const sf::Vector2f& direction) : position(position), direction(direction), category(category), diff --git a/source/abstract/Sprite.h b/source/abstract/Sprite.h index 9ae0686..96ba7e2 100755 --- a/source/abstract/Sprite.h +++ b/source/abstract/Sprite.h @@ -32,12 +32,14 @@ public: }; /** - * Container that carries all data required to construct an object of this class. + * Container that carries all data required to construct an object of + * this class. */ class Data { public: - Data(const sf::Vector2f& position, const sf::Vector2f& direction, - Category category, unsigned short mask); + Data(const sf::Vector2f& position, + Category category, unsigned short mask, + const sf::Vector2f& direction = sf::Vector2f(0, 0)); const sf::Vector2f& position; const sf::Vector2f& direction; Category category; diff --git a/source/effects/Bullet.cpp b/source/effects/Bullet.cpp index e9b7dcc..97eb337 100755 --- a/source/effects/Bullet.cpp +++ b/source/effects/Bullet.cpp @@ -26,7 +26,7 @@ const float Bullet::DEFAULT_SPEED = 500; */ Bullet::Bullet(const sf::Vector2f& position, Sprite& shooter, sf::Vector2f direction, const Yaml& config) : - Particle(config, Data(position, sf::Vector2f(0, 0), CATEGORY_PARTICLE, + Particle(config, Data(position, CATEGORY_PARTICLE, ~CATEGORY_PARTICLE)), mShooter(shooter), mDamage(config.get(KEY_DAMAGE, DEFAULT_DAMAGE)), diff --git a/source/sprites/Corpse.cpp b/source/sprites/Corpse.cpp index ba53c4e..0649928 100644 --- a/source/sprites/Corpse.cpp +++ b/source/sprites/Corpse.cpp @@ -8,7 +8,6 @@ #include "Corpse.h" Corpse::Corpse(const sf::Vector2f& position, const Yaml& config) : - Sprite(Data(position, sf::Vector2f(0, 0), CATEGORY_NONSOLID, MASK_NONE), - config) { + Sprite(Data(position, CATEGORY_NONSOLID, MASK_NONE), config) { } diff --git a/source/sprites/Enemy.cpp b/source/sprites/Enemy.cpp index e6fed40..9a8b550 100644 --- a/source/sprites/Enemy.cpp +++ b/source/sprites/Enemy.cpp @@ -9,6 +9,5 @@ Enemy::Enemy(World& world, const sf::Vector2f& position, const Yaml& config) : - Character(world, Data(position, sf::Vector2f(0, 0), - CATEGORY_ACTOR, MASK_ALL), config) { + Character(world, Data(position, CATEGORY_ACTOR, MASK_ALL), config) { } diff --git a/source/sprites/Player.cpp b/source/sprites/Player.cpp index c2db0f7..0480e7b 100644 --- a/source/sprites/Player.cpp +++ b/source/sprites/Player.cpp @@ -12,10 +12,10 @@ /** * Initializes Sprite. */ -Player::Player(World& world, const sf::Vector2f& position, const Yaml& config) : - Character(world, Data(position, sf::Vector2f(0, 0), CATEGORY_ACTOR, - MASK_ALL), config), - mDirection(0) { +Player::Player(World& world, const sf::Vector2f& position, + const Yaml& config) : + Character(world, Data(position, CATEGORY_ACTOR, MASK_ALL), config), + mDirection(0) { } /** diff --git a/source/sprites/TileManager.cpp b/source/sprites/TileManager.cpp index 5e8c71a..96c9d4d 100644 --- a/source/sprites/TileManager.cpp +++ b/source/sprites/TileManager.cpp @@ -31,7 +31,7 @@ TileManager::TileManager(World& world) : */ TileManager::Tile::Tile(Type type, const TilePosition& position) : Sprite(Data(sf::Vector2f(position.x * TILE_SIZE.x, position.y * TILE_SIZE.y), - sf::Vector2f(0, 0), CATEGORY_WORLD, (type == Type::FLOOR) ? MASK_NONE : MASK_ALL), + CATEGORY_WORLD, (type == Type::FLOOR) ? MASK_NONE : MASK_ALL), Yaml(getConfig(type))), mType(type) { }