changeset 1270:2e4a07ad5243

Player::GetSkillIdxByOrder cleanup - changing cycles to fors
author Grumpy7
date Sat, 15 Jun 2013 02:15:03 +0200
parents 34b08429a6b8
children 5a3f48b370d5
files Player.cpp
diffstat 1 files changed, 11 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- 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 );
         }
       }
     }