Do you think this one is a better version than the other one I posted earlier? I changed the union to an enum struct(which is a scoped enum correct?) to make more simple.
An enumeration is supposed to be a set of distinct values. You have made several of them equivalent, which I'm sure is not what you really want:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
enum ArmorType {
EMPTY = true,
STEEL = false,
IRON = false,
LEATHER = false,
TITANIUM = false
};
// some code
ArmorType myArmor = EMPTY;
// ... person gets some new armor
myArmor = LEATHER;
// later, suppose we need to check their type of armor
if(myArmor == STEEL) {
// returns true!
// This is because you have defined LEATHER and STEEL as being the same value, so they compare equal.
You might want to re-read a quick description of how to use an enumeration. You'll probably be able to figure out what the problem here is if you haven't already.
Yeah I understand it now, I was thinking I could just change/switch around the values but now I understand that's just more work. So I just assigned them different numbers now. I'll probably reassign the numbers in order from lowest to greatest depending on how good the armor type is. Anyways thanks guys! I'll try and finish this soon maybe today, but yeah.