From c09d30cb144ce421ef0e1a786d2965f9abcde0aa Mon Sep 17 00:00:00 2001 From: fusion32 Date: Sun, 29 Jun 2025 18:25:23 -0300 Subject: `houses.cc` --- src/crnonpl.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'src/crnonpl.cc') diff --git a/src/crnonpl.cc b/src/crnonpl.cc index b05a5e5..29a5d11 100644 --- a/src/crnonpl.cc +++ b/src/crnonpl.cc @@ -1856,9 +1856,9 @@ void TNPC::GiveTo(ObjectType Type, int Amount){ if(Type.getFlag(CUMULATIVE)){ while(Amount > 0){ - int StackSize = std::min(Amount, 100); - CreateAtCreature(this->Interlocutor, Type, StackSize); - Amount -= StackSize; + int StackAmount = std::min(Amount, 100); + CreateAtCreature(this->Interlocutor, Type, StackAmount); + Amount -= StackAmount; } }else{ while(Amount > 0){ @@ -1890,9 +1890,10 @@ void TNPC::GetMoney(int Amount){ int Gold = CountInventoryObjects(this->Interlocutor, GetSpecialObject(MONEY_ONE), 0); CalculateChange(Amount, &Gold, &Platinum, &Crystal); - ASSERT(Crystal >= 0); - if(Crystal > 0){ - this->GetFrom(GetSpecialObject(MONEY_TENTHOUSAND), Crystal); + if(Gold > 0){ + this->GetFrom(GetSpecialObject(MONEY_ONE), Gold); + }else if(Gold < 0){ + this->GiveTo(GetSpecialObject(MONEY_ONE), -Gold); } if(Platinum > 0){ @@ -1901,10 +1902,9 @@ void TNPC::GetMoney(int Amount){ this->GiveTo(GetSpecialObject(MONEY_HUNDRED), -Platinum); } - if(Gold > 0){ - this->GetFrom(GetSpecialObject(MONEY_ONE), Gold); - }else if(Gold < 0){ - this->GiveTo(GetSpecialObject(MONEY_ONE), -Gold); + ASSERT(Crystal >= 0); + if(Crystal > 0){ + this->GetFrom(GetSpecialObject(MONEY_TENTHOUSAND), Crystal); } } -- cgit v1.2.3