• Create Account

### #Actuallightxbulb

Posted 17 May 2013 - 12:20 PM

Why don't you make a class Skill and add a list in your iUnit class that will contain numerous instances of Skill(for the different skills) - basically your units will contain a list of skills.  Add some method in iUnit to access a given skill (basically you search in the list of skills) and from there you can use the Skill class methods for the given instance of skill.

Something like this:

class iUnit
{

protected:
list list_of_skills;

Skill& access_skill_by_index(unsigned short input_index)
{
//find the given instance of skill in list_of_skills by using the input_index
//and return that instance
}

...

};


You can use whatever you find better for "list" - an array, a vector, a linked list etc. And you can code the access_skill_by_index method differently - you might want to access a given skill by some other means.

### #4lightxbulb

Posted 17 May 2013 - 12:20 PM

Why don't you make a class Skill and add a list in your iUnit class that will contain numerous instances of Skill(for the different skills) - basically your units will contain a list of skills.  Add some method in iUnit to access a given skill (basically you search in the list of skills) and from there you can use the Skill class methods for the given instance of skill.

Something like this:

class iUnit
{

protected:
list list_of_skills;

Skill& access_skill_by_index(unsigned short input_index)
{
//find the given instance of skill in list_of_skills by using the input_index
//and return that instance
};

...

};


You can use whatever you find better for "list" - an array, a vector, a linked list etc. And you can code the access_skill_by_index method differently - you might want to access a given skill by some other means.

### #3lightxbulb

Posted 17 May 2013 - 12:14 PM

Why don't you make a class Skill and add a list in your iUnit class that will contain numerous instances of Skill(for the different skills) - basically your units will contain a list of skills.  Add some method in iUnit to access a given skill (basically you search in the list of skills) and from there you can use the Skill class methods for the given instance of skill.

### #2lightxbulb

Posted 17 May 2013 - 12:14 PM

Why don't you make a class Skill and add a list in your iUnit class that will contain numerous instances of Skill(for the different skills) - basically your units will contain a list of skills.  Add some method in iUnit to access a given skill (basically you search in the list of skills) and from there you can use the Skill class methods for the given skill.

### #1lightxbulb

Posted 17 May 2013 - 12:13 PM

Why don't you make a class Skill and add a list in your iUnit class that will contain numerous instances of Skill(for the different skills) - basically your units will contain a is of skills.  Add some method in iUnit to access a given skill (basically you search in the list of skills) and from there you can use the Skill class methods for the given skill.

PARTNERS