Moved weapon file name from code to YAML.

This commit is contained in:
Felix Ableitner 2012-12-24 00:49:49 +01:00
parent b6002eb6fd
commit 5433e14f51
2 changed files with 5 additions and 1 deletions

View file

@ -20,6 +20,8 @@ const int Character::DEFAULT_HEALTH = 100;
const std::string Character::KEY_SPEED = "speed";
const float Character::DEFAULT_SPEED = 100;
const float Character::POINT_REACHED_DISTANCE = 1.0f;
const std::string Character::KEY_WEAPON = "weapon";
const std::string Character::DEFAULT_WEAPON = "weapon.yaml";
std::vector<Character*> Character::mCharacterInstances = std::vector<Character*>();
/**
@ -33,7 +35,7 @@ Character::Character(World& world, Pathfinder& pathfinder,
mMaxHealth(config.get(KEY_HEALTH, DEFAULT_HEALTH)),
mCurrentHealth(mMaxHealth),
mMovementSpeed(config.get(KEY_SPEED, DEFAULT_SPEED)),
mWeapon(world, *this, Yaml("weapon.yaml")),
mWeapon(world, *this, Yaml(config.get(KEY_WEAPON, DEFAULT_WEAPON))),
mStartPathfinding(false) {
mCharacterInstances.push_back(this);
}

View file

@ -53,6 +53,8 @@ private:
static const int DEFAULT_HEALTH;
static const std::string KEY_SPEED;
static const float DEFAULT_SPEED;
static const std::string KEY_WEAPON;
static const std::string DEFAULT_WEAPON;
/// The distance to a point where it is considered reached.
static const float POINT_REACHED_DISTANCE;