Fixed "At Gold Limit" popping every time you are gold capped and buy any item (with extended costs)

--HG--
branch : trunk
This commit is contained in:
Shauren
2010-07-14 12:02:27 +02:00
parent af8a2e754c
commit 6aa9ee1a2f
+11 -3
View File
@@ -1439,12 +1439,20 @@ class Player : public Unit, public GridObject<Player>
if (d < 0)
SetMoney (GetMoney() > uint32(-d) ? GetMoney() + d : 0);
else
SetMoney (GetMoney() < uint32(MAX_MONEY_AMOUNT - d) ? GetMoney() + d : MAX_MONEY_AMOUNT);
{
uint32 newAmount = 0;
if (GetMoney() < uint32(MAX_MONEY_AMOUNT - d))
newAmount = GetMoney() + d;
else
{
// "At Gold Limit"
if (GetMoney() >= MAX_MONEY_AMOUNT)
newAmount = MAX_MONEY_AMOUNT;
if (d)
SendEquipError(EQUIP_ERR_TOO_MUCH_GOLD, NULL, NULL);
}
SetMoney (newAmount);
}
}
void SetMoney(uint32 value)
{
SetUInt32Value (PLAYER_FIELD_COINAGE, value);