diff Player.cpp @ 753:e13ce1b0930d

Merge
author Gloval
date Sat, 23 Mar 2013 00:53:15 +0400
parents f39fbeb65b28
children 0b3f4b854652
line wrap: on
line diff
--- a/Player.cpp	Sat Mar 23 00:50:58 2013 +0400
+++ b/Player.cpp	Sat Mar 23 00:53:15 2013 +0400
@@ -336,16 +336,14 @@
 }
 
 //----- (004B8142) --------------------------------------------------------
-int Player::_4B8142(int a2, float a3)
-{
-  int result; // eax@1
-
-  result = (int)((100 - GetMerchant()) * (unsigned __int64)(signed __int64)((double)a2 * a3)) / 100;
-  if ( result < a2 )
-    result = a2;
-  if ( result < 1 )
-    result = 1;
-  return result;
+int Player::GetBuyingPrice(unsigned int uRealValue, float price_multiplier)
+{
+  uint price = ((100 - GetMerchant()) * (uRealValue * price_multiplier)) / 100;
+  assert (price > 0);
+
+  if (price < uRealValue)
+    price = uRealValue;
+  return price;
 }
 
 //----- (004B8179) --------------------------------------------------------
@@ -1858,7 +1856,7 @@
   v14 = &p2DEvents[a4 - 1].fPriceMultiplier;
   v15 = *v14;
   v16 = pItem->GetValue();
-  v17 = _4B8142(v16, v15);
+  v17 = GetBuyingPrice(v16, v15);
   if ( a5 == 3 )
   {
     v23 = *v14;