aboutsummaryrefslogtreecommitdiff
path: root/src/crnonpl.cc
diff options
context:
space:
mode:
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);
}
}