Thanks Disch, I really shouldn't have the list there.
So would it look like this?
Player::Player()
: Entity("Unnamed", sf::Vector2f(0,0), 100, 10, 3)
Then if I wanted to do Player player("name", etc) I would need to overload the Player ctor?
Also, to avoid making another topic, can someone tell me why I'm getting an error about a line that I've commented out?
1 2 3 4
|
void Entity::AddSkill(Action* skill)
{
skills.push_back(skill);
}
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
class Action;
class Entity
{
public:
Entity(std::string sName="Unnamed", sf::Vector2f v2fPos=sf::Vector2f(0,0),
unsigned int uhealth = 100, unsigned int ustrength = 10,
unsigned int uskillpoints = 3);
virtual ~Entity();
virtual void Move(sf::Vector2f dydx) = 0;
virtual void TakeDamage(int dmg) = 0;
virtual int CheckHealth() = 0;
virtual int Attack(Entity* target) = 0; // Attack a single target.
virtual int Attack(std::list<Entity*> targets) = 0; // Attack multiple targets
virtual std::list<Action*> CheckSkills();
//virtual void AddSkill(Action* skill); Error here... but it's COMMENTED OUT?
std::string name;
sf::Vector2f pos;
protected:
unsigned int health;
unsigned int strength;
unsigned int skillpoints;
std::list<Action*> skills;
virtual bool Init() = 0; // We will need to define separate Init()
// functions for each class that we create, since
// they will have their own static sf::Image instances.
};
|
error: prototype for 'void Entity::AddSkill(Action*)' does not match any in class 'Entity' |
error: candidate is: virtual void Entity::AddSkill(const Action*) | it's commented out..