changeset 1617:8e3c6d7631f1

Player::GetRace cleaned up + removed a few unused vars
author Grumpy7
date Sat, 14 Sep 2013 06:56:05 +0200
parents 434b796cdfd3
children f5b13e6be493
files Player.cpp
diffstat 1 files changed, 24 insertions(+), 34 deletions(-) [+]
line wrap: on
line diff
--- a/Player.cpp	Sat Sep 14 06:46:12 2013 +0200
+++ b/Player.cpp	Sat Sep 14 06:56:05 2013 +0200
@@ -3468,7 +3468,7 @@
 
 //----- (0048F882) --------------------------------------------------------
 int Player::GetActualSkillLevel( PLAYER_SKILL_TYPE uSkillType )
-    {
+{
   signed int bonus_value; // esi@1
   unsigned __int16 skill_value; // ax@126
   int result; // al@127
@@ -3941,40 +3941,31 @@
 //                     24   zombie female
 enum CHARACTER_RACE Player::GetRace()
 {
-  if ( uCurrentFace > 15 )
-  {
-    if ( uCurrentFace >= 16 && uCurrentFace <= 19 )
-      return CHARACTER_RACE_GOBLIN;
+  if ( uCurrentFace <= 7 )
+  {
+    return CHARACTER_RACE_HUMAN;
+  }
+  else if ( uCurrentFace <= 11 )
+  {
+      return CHARACTER_RACE_ELF;
+  }
+  else if ( uCurrentFace <= 15 )
+  {
+    return CHARACTER_RACE_DWARF;
+  }
+  else if ( uCurrentFace <= 19 )
+  {
+    return CHARACTER_RACE_GOBLIN;
   }
   else
   {
-    if ( uCurrentFace >= 12 )
-    {
-      return CHARACTER_RACE_DWARF;
-    }
-    else
-    {
-      
-        if ( uCurrentFace <= 7 )
-        {
-          return CHARACTER_RACE_HUMAN;
-        }
-        else
-        {
-          if ( uCurrentFace <= 11 )
-            return CHARACTER_RACE_ELF;
-        }
-    }
-  }
-  return CHARACTER_RACE_HUMAN;
+    return CHARACTER_RACE_HUMAN;
+  }
 }
 
 //----- (00490141) --------------------------------------------------------
 PLAYER_SEX Player::GetSexByVoice()
 {
-  signed int result; // eax@1
-
-  result = 0;
   switch ( this->uVoiceID )
   {
     case 0u:
@@ -4024,7 +4015,7 @@
 
 //----- (004901FC) --------------------------------------------------------
 void Player::SetSexByVoice()
-    {
+{
   switch ( this->uVoiceID)
   {
     case 0:
@@ -4056,6 +4047,7 @@
       this->uSex = SEX_FEMALE;
       break;
     default:
+      Error("(%u)", this->uVoiceID);
       break;
   }
  
@@ -4264,18 +4256,16 @@
 //unsigned __int16 PartyCreation_BtnMinusClick(Player *_this, int eAttribute)
 void Player::DecreaseAttribute(int eAttribute)
 {
-  int v2; // eax@1
   int pBaseValue; // ecx@1
   int pDroppedStep; // ebx@1
   int pStep; // esi@1
-  unsigned __int16 result; // ax@7
   int uMinValue; // [sp+Ch] [bp-4h]@1
 
-  v2 = eAttribute + 7 * GetRace();
-  pBaseValue = StatTable[0][v2].uBaseValue;
-  pDroppedStep = StatTable[0][v2].uDroppedStep;
+  int raceId = GetRace();
+  pBaseValue = StatTable[raceId][eAttribute].uBaseValue;
+  pDroppedStep = StatTable[raceId][eAttribute].uDroppedStep;
   uMinValue = pBaseValue - 2;
-  pStep = StatTable[0][v2].uBaseStep;
+  pStep = StatTable[raceId][eAttribute].uBaseStep;
   unsigned short* AttrToChange = nullptr;
   switch ( eAttribute )
   {