aboutsummaryrefslogtreecommitdiff
path: root/src/crnonpl.cc
diff options
context:
space:
mode:
authorfusion32 <marcopuzziello@gmail.com>2025-06-29 18:25:23 -0300
committerfusion32 <marcopuzziello@gmail.com>2025-06-29 18:25:23 -0300
commitc09d30cb144ce421ef0e1a786d2965f9abcde0aa (patch)
tree877611a3837996b9acddc5eaa8d30a9aa4424955 /src/crnonpl.cc
parente59667ec6be0a21ce702ce077154357a1c7f7c04 (diff)
downloadgame-c09d30cb144ce421ef0e1a786d2965f9abcde0aa.tar.gz
game-c09d30cb144ce421ef0e1a786d2965f9abcde0aa.zip
`houses.cc`
Diffstat (limited to 'src/crnonpl.cc')
-rw-r--r--src/crnonpl.cc20
1 files changed, 10 insertions, 10 deletions
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<int>(Amount, 100);
- CreateAtCreature(this->Interlocutor, Type, StackSize);
- Amount -= StackSize;
+ int StackAmount = std::min<int>(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);
}
}