changeset 1275:7569c88d9cb0

renamed a few unnamed functions
author Grumpy7
date Sat, 15 Jun 2013 06:51:04 +0200
parents 351bc06722f2
children f11651288371
files Player.cpp Player.h mm7_4.cpp
diffstat 3 files changed, 52 insertions(+), 48 deletions(-) [+]
line wrap: on
line diff
--- a/Player.cpp	Sat Jun 15 05:08:48 2013 +0200
+++ b/Player.cpp	Sat Jun 15 06:51:04 2013 +0200
@@ -200,9 +200,9 @@
 //----- (00427730) --------------------------------------------------------
 bool Player::CanCastSpell(unsigned int uRequiredMana)
 {
-  if (sMana >= uRequiredMana)
-  {
-    sMana -= uRequiredMana;
+  if (sMana >= (signed int)uRequiredMana)
+  {
+    sMana -= (signed int)uRequiredMana;
     return true;
   }
 
@@ -266,9 +266,9 @@
   int v6; // eax@8
   signed int result; // qax@13
   signed int baseConditionMultiplier; // [sp+8h] [bp-8h]@4
-  
+
   conditionIdx = GetMajorConditionIdx();
-  if ( conditionIdx >= 14 )
+  if ( conditionIdx >= 14 && conditionIdx <= 16)
   {
     if ( conditionIdx <= 15 )
     {
@@ -280,7 +280,7 @@
     }
     conditionTimeMultiplier = GetConditionDayOfWeek(conditionIdx);
   }
-  else
+  else if (conditionIdx < 14)
   {
     baseConditionMultiplier = 1;
     conditionTimeMultiplier = 0;
@@ -293,7 +293,11 @@
     if ( !conditionTimeMultiplier )
       conditionTimeMultiplier = 1;
   }
-  result = ((double)conditionTimeMultiplier * (double)baseConditionMultiplier * a2);
+  else{
+    conditionTimeMultiplier = 1;
+    baseConditionMultiplier = 1;
+  }
+  result = (int)((double)conditionTimeMultiplier * (double)baseConditionMultiplier * a2);
   if ( result < 1 )
     result = 1;
   return result;
@@ -305,7 +309,7 @@
   signed int v3; // esi@1
   signed int result; // eax@3
 
-  v3 = (unsigned __int64)(signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100;
+  v3 = (signed int)((signed __int64)((double)uRealValue / (price_multiplier + 2.0)) + uRealValue * GetMerchant() / 100);
   if ( v3 > uRealValue )
     v3 = uRealValue;
   result = 1;
@@ -317,7 +321,7 @@
 //----- (004B8142) --------------------------------------------------------
 int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier)
 {
-  uint price = ((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100;
+  uint price = (uint)(((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100);
   assert (price > 0);
 
   if (price < uRealValue)
@@ -332,7 +336,7 @@
   int v3; // ecx@1
   signed int result; // eax@3
 
-  v2 = (signed __int64)(a2 * 50.0);
+  v2 = (signed int)(a2 * 50.0);
   v3 = v2 * (100 - GetMerchant()) / 100;
   if ( v3 < v2 / 3 )
     v3 = v2 / 3;
@@ -349,7 +353,7 @@
   int v4; // ecx@1
   signed int result; // eax@3
 
-  v3 = (signed __int64)((double)a2 / (6.0 - a3));
+  v3 = (signed int)((double)a2 / (6.0 - a3));
   v4 = v3 * (100 - GetMerchant()) / 100;
   if ( v4 < v3 / 3 )
     v4 = v3 / 3;
@@ -360,46 +364,46 @@
 }
 
 //----- (004B8213) --------------------------------------------------------
-int Player::_4B8213(int a2, float a3)
-{
-  signed __int64 v3; // qax@1
-
-  v3 = (signed __int64)((double)a2 / (a3 + 2.0));
-  if ( (signed int)v3 < 1 )
-    LODWORD(v3) = 1;
+int Player::GetBaseSellingPrice(int a2, float a3)
+{
+  signed int v3; // qax@1
+
+  v3 = (signed int)((double)a2 / (a3 + 2.0));
+  if ( v3 < 1 )
+    v3 = 1;
   return v3;
 }
 
 //----- (004B8233) --------------------------------------------------------
-int Player::_4B8233(int a2, float a3)
-{
-  signed __int64 v3; // qax@1
-
-  v3 = (signed __int64)((double)a2 * a3);
-  if ( (signed int)v3 < 1 )
-    LODWORD(v3) = 1;
+int Player::GetBaseBuyingPrice(int a2, float a3)
+{
+  signed int v3; // qax@1
+
+  v3 = (signed int)((double)a2 * a3);
+  if ( v3 < 1 )
+    v3 = 1;
   return v3;
 }
 
 //----- (004B824B) --------------------------------------------------------
-int Player::_4B824B(float a2)
-{
-  signed __int64 v2; // qax@1
-
-  v2 = (signed __int64)(a2 * 50.0);
-  if ( (signed int)v2 < 1 )
-    LODWORD(v2) = 1;
+int Player::GetBaseIdentifyPrice(float a2)
+{
+  signed int v2; // qax@1
+
+  v2 = (signed int)(a2 * 50.0);
+  if ( v2 < 1 )
+    v2 = 1;
   return v2;
 }
 
 //----- (004B8265) --------------------------------------------------------
-int Player::_4B8265(int a2, float a3)
-{
-  signed __int64 v3; // qax@1
-
-  v3 = (signed __int64)((double)a2 / (6.0 - a3));
-  if ( (signed int)v3 < 1 )
-    LODWORD(v3) = 1;
+int Player::GetBaseRepairPrice(int a2, float a3)
+{
+  signed int v3; // qax@1
+
+  v3 = (signed int)((double)a2 / (6.0 - a3));
+  if ( v3 < 1 )
+    v3 = 1;
   return v3;
 }
 
--- a/Player.h	Sat Jun 15 05:08:48 2013 +0200
+++ b/Player.h	Sat Jun 15 06:51:04 2013 +0200
@@ -576,10 +576,10 @@
   void ItemsEnchant(int enchant_count);
   unsigned int GetItemIDAtInventoryIndex(int *a2);
   int _4B6FF9();
-  int _4B824B(float a2);
-  int _4B8265(int a2, float a3);
-  int _4B8233(int a2, float a3);
-  int _4B8213(int a2, float a3);
+  int GetBaseIdentifyPrice(float a2);
+  int GetBaseRepairPrice(int a2, float a3);
+  int GetBaseBuyingPrice(int a2, float a3);
+  int GetBaseSellingPrice(int a2, float a3);
   int GetPriceRepair(int a2, float a3);
   int GetPriceIdentification(float a2);
   int GetBuyingPrice(unsigned int uRealValue, float price_multiplier);
--- a/mm7_4.cpp	Sat Jun 15 05:08:48 2013 +0200
+++ b/mm7_4.cpp	Sat Jun 15 06:51:04 2013 +0200
@@ -3594,26 +3594,26 @@
             v37 = &p2DEvents[(signed int)a4 - 1].fPriceMultiplier;
             v38 = *v37;
             v39 = a3->GetValue();
-            v29 = pPlayer->_4B8233(v39, v38);
+            v29 = pPlayer->GetBaseBuyingPrice(v39, v38);
           switch ( a5 )
           {
             case 3:
               v44 = *v37;
               v45 = a3->GetValue();
-              v29 = pPlayer->_4B8213(v45, v44);
+              v29 = pPlayer->GetBaseSellingPrice(v45, v44);
               break;
             case 4:
-              v29 = pPlayer->_4B824B(*v37);
+              v29 = pPlayer->GetBaseIdentifyPrice(*v37);
               break;
             case 5:
               v42 = *v37;
               v43 = a3->GetValue();
-              v29 = pPlayer->_4B8265(v43, v42);
+              v29 = pPlayer->GetBaseRepairPrice(v43, v42);
               break;
             case 6:
               v40 = *v37;
               v41 = a3->GetValue();
-              v29 = pPlayer->_4B8213(v41, v40) / 2;
+              v29 = pPlayer->GetBaseSellingPrice(v41, v40) / 2;
               break;
             }
             goto _continue_sprintf;