# HG changeset patch # User Grumpy7 # Date 1371255303 -7200 # Node ID 2e4a07ad5243016b7799f49d346d6337abed68f1 # Parent 34b08429a6b8a86818848bf8c135d86fc7e80f86 Player::GetSkillIdxByOrder cleanup - changing cycles to fors diff -r 34b08429a6b8 -r 2e4a07ad5243 Player.cpp --- a/Player.cpp Sat Jun 15 01:58:19 2013 +0200 +++ b/Player.cpp Sat Jun 15 02:15:03 2013 +0200 @@ -6375,25 +6375,24 @@ int v7; // esi@18 unsigned __int16 *pActiveSkill; // edx@18 + if ( order >= 0 ) { + if ( order <= 1 ) { result = (PLAYER_SKILL_TYPE)0; v7 = 0; pActiveSkill = this->pActiveSkills; - do + for (int i = 0; i < 37; i++) { - if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 2 ) + if ( this->pActiveSkills[i] && pSkillAvailabilityPerClass[classType / 4][i] == 2 ) // 2 - primary skill { if ( v7 == order ) - return result; + return (PLAYER_SKILL_TYPE)i; ++v7; } - result = (PLAYER_SKILL_TYPE)((int)result + 1); - ++pActiveSkill; } - while ( (signed int)result < 37 ); } else { @@ -6402,38 +6401,30 @@ result = (PLAYER_SKILL_TYPE)0; v5 = 0; pActiveSkill = this->pActiveSkills; - do + for (int i = 0; i < 37; i++) { - if ( *pActiveSkill && pSkillAvailabilityPerClass[classType / 4][result] == 1 ) + if ( this->pActiveSkills[i] && pSkillAvailabilityPerClass[classType / 4][i] == 1 ) // 2 - primary skill { if ( v5 == order - 2 ) - return result; + return (PLAYER_SKILL_TYPE)i; ++v5; } - result = (PLAYER_SKILL_TYPE)((int)result + 1); - ++pActiveSkill; } - while ( (signed int)result < 37 ); } else { if ( order <= 12 ) { - result = (PLAYER_SKILL_TYPE)0; v3 = 0; - v4 = (char *)pSkillAvailabilityPerClass[classType / 4]; - do + for (int i = 0; i < 37; i++) { - if ( *v4 == 1 ) + if ( pSkillAvailabilityPerClass[classType / 4][i] == 1 ) { if ( v3 == order - 4 ) - return result; + return (PLAYER_SKILL_TYPE)i; ++v3; } - result = (PLAYER_SKILL_TYPE)((int)result + 1); - ++v4; } - while ( (signed int)result < 37 ); } } }