Made direction param optional in Sprite::Data.

This commit is contained in:
Felix Ableitner 2013-03-30 02:36:06 +01:00
parent 47d9882e77
commit a083708850
7 changed files with 15 additions and 15 deletions

View file

@ -69,8 +69,8 @@ Sprite::~Sprite() {
/** /**
* Initializes container. * Initializes container.
*/ */
Sprite::Data::Data(const sf::Vector2f& position, const sf::Vector2f& direction, Sprite::Data::Data(const sf::Vector2f& position, Category category,
Category category, unsigned short mask) : unsigned short mask, const sf::Vector2f& direction) :
position(position), position(position),
direction(direction), direction(direction),
category(category), category(category),

View file

@ -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 { class Data {
public: public:
Data(const sf::Vector2f& position, const sf::Vector2f& direction, Data(const sf::Vector2f& position,
Category category, unsigned short mask); Category category, unsigned short mask,
const sf::Vector2f& direction = sf::Vector2f(0, 0));
const sf::Vector2f& position; const sf::Vector2f& position;
const sf::Vector2f& direction; const sf::Vector2f& direction;
Category category; Category category;

View file

@ -26,7 +26,7 @@ const float Bullet::DEFAULT_SPEED = 500;
*/ */
Bullet::Bullet(const sf::Vector2f& position, Sprite& shooter, Bullet::Bullet(const sf::Vector2f& position, Sprite& shooter,
sf::Vector2f direction, const Yaml& config) : sf::Vector2f direction, const Yaml& config) :
Particle(config, Data(position, sf::Vector2f(0, 0), CATEGORY_PARTICLE, Particle(config, Data(position, CATEGORY_PARTICLE,
~CATEGORY_PARTICLE)), ~CATEGORY_PARTICLE)),
mShooter(shooter), mShooter(shooter),
mDamage(config.get(KEY_DAMAGE, DEFAULT_DAMAGE)), mDamage(config.get(KEY_DAMAGE, DEFAULT_DAMAGE)),

View file

@ -8,7 +8,6 @@
#include "Corpse.h" #include "Corpse.h"
Corpse::Corpse(const sf::Vector2f& position, const Yaml& config) : Corpse::Corpse(const sf::Vector2f& position, const Yaml& config) :
Sprite(Data(position, sf::Vector2f(0, 0), CATEGORY_NONSOLID, MASK_NONE), Sprite(Data(position, CATEGORY_NONSOLID, MASK_NONE), config) {
config) {
} }

View file

@ -9,6 +9,5 @@
Enemy::Enemy(World& world, const sf::Vector2f& position, Enemy::Enemy(World& world, const sf::Vector2f& position,
const Yaml& config) : const Yaml& config) :
Character(world, Data(position, sf::Vector2f(0, 0), Character(world, Data(position, CATEGORY_ACTOR, MASK_ALL), config) {
CATEGORY_ACTOR, MASK_ALL), config) {
} }

View file

@ -12,10 +12,10 @@
/** /**
* Initializes Sprite. * Initializes Sprite.
*/ */
Player::Player(World& world, const sf::Vector2f& position, const Yaml& config) : Player::Player(World& world, const sf::Vector2f& position,
Character(world, Data(position, sf::Vector2f(0, 0), CATEGORY_ACTOR, const Yaml& config) :
MASK_ALL), config), Character(world, Data(position, CATEGORY_ACTOR, MASK_ALL), config),
mDirection(0) { mDirection(0) {
} }
/** /**

View file

@ -31,7 +31,7 @@ TileManager::TileManager(World& world) :
*/ */
TileManager::Tile::Tile(Type type, const TilePosition& position) : TileManager::Tile::Tile(Type type, const TilePosition& position) :
Sprite(Data(sf::Vector2f(position.x * TILE_SIZE.x, position.y * TILE_SIZE.y), 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))), Yaml(getConfig(type))),
mType(type) { mType(type) {
} }