diff Player.cpp @ 749:f39fbeb65b28

Fixed bought items not disappearing from Armourer.
author Nomad
date Fri, 22 Mar 2013 23:26:01 +0200
parents 6daaa2f18d0d
children 0b3f4b854652
line wrap: on
line diff
--- a/Player.cpp	Fri Mar 22 22:36:26 2013 +0200
+++ b/Player.cpp	Fri Mar 22 23:26:01 2013 +0200
@@ -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;