How about wrapping it in a class that represents quantity as well? What I mean is
class CreatureGroup {
Creature creature;
int quantity;
};
Question
I have just started writing simple RPG game in C++. There will be a class (schema, not code)
class creature
string name;
int hp, strength...
There will also be quantity of them. But if I want to create two groups of same type creature, example: ('a', 100, 10)'
, it would be wasting of time and memory to make them separately, writing name and all other parameters two times, with only quantity being different. Do you know any method to implement quantity of creatures stacks, without necessity to repeat data?
Because I have just started working, I will be trying to do something and tell you about results.
Solution
How about wrapping it in a class that represents quantity as well? What I mean is
class CreatureGroup {
Creature creature;
int quantity;
};