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.
*/
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),

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 {
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;

View file

@ -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)),

View file

@ -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) {
}

View file

@ -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) {
}

View file

@ -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) {
}
/**

View file

@ -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) {
}