bool CreatureClass::InitAbilities(int* val) {
int* tmp = newint[ABILITY_MAX];
for (int i = 0; i < ABILITY_MAX; i++) {
if (val[i] >= 0)
tmp[i] = val[i];
elsereturnfalse; // if any ability < 0
} // return false
CopyIntoAbil(tmp); // copy tmp into abilities if
returntrue; // since all are valid
}
When I try it I get this compiler error:
1 2 3 4
Source/Troll.cpp: In constructor ‘TrollClass::TrollClass(std::string)’:
Source/Troll.cpp:37:43: error: invalid conversion from ‘constint*’ to ‘int*’
Source/Troll.cpp:37:43: error: initializing argument 1 of ‘bool CreatureClass::InitAbilities(int*)’
make: *** [Source/Troll.o] Error 1