Maybe I am reading this wrong, but here we go.
Since this works between the constants of Dex and Cha, wouldn't that be 1-5? Would not ABILITY_STRENGTH, which is 0, be ignored this way?
God I'm terrible at loops. I have no idea how I've avoided medication from using these.
Alright, the for works by cycling through the first expression, in this case 1 (for dexterity), until it reaches the second expression, which would be 5 (for charisma). The i++ means it goes up by one, which means that it would cycle 1, 2, 3, 4, right? If that's the case wouldn't it skip 0 and 6, Strength and Charisma? Unless that <= ABILITY_CHARISMA means that it also includes 5? Not sure there.
I see that it goes and checks it against the strength score and picks the highest though....
Should it be:
int nHighAbility = ABILITY_STRENGTH
int nHigh = GetAbilityScore(oPC, nHighAbility);
int i;
for ( i = ABILITY_STRENGTH; i <= ABILITY_CHARISMA; i ++ ) {
int nTemp = GetAbilityScore(oPC, i);
if (nTemp > nHigh) {
nHigh = nTemp;
nHighAbility = i;
}
}
I ask because I looked up the lexicon for what numbers the constant pulls, and double checked the for loop, because I plan to convert the pulled int to determine a string that names the ability score. Like:
string sAbility;
switch (i)
{
case 0: sAbility = "Strength"; break;
case 1: sAbility = "Dexterity"; break;
.
.
.
.