diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2025-06-08 19:54:40 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2025-06-08 19:54:40 -0300 |
| commit | eaa3536c027a4f7c1b879b78ab0ecdefcdb4833d (patch) | |
| tree | 03f851e558656f8fc36fdb982c28fbc09cef8dac /src/crmain.cc | |
| parent | ab9f606371a1df23e9cacbffa0811db7a9e50100 (diff) | |
| download | game-eaa3536c027a4f7c1b879b78ab0ecdefcdb4833d.tar.gz game-eaa3536c027a4f7c1b879b78ab0ecdefcdb4833d.zip | |
impl `TCreature::Move` which was absolute hell + some tidying up
Diffstat (limited to 'src/crmain.cc')
| -rw-r--r-- | src/crmain.cc | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/src/crmain.cc b/src/crmain.cc index 5d0f2f3..00cd3e2 100644 --- a/src/crmain.cc +++ b/src/crmain.cc @@ -226,7 +226,9 @@ TCreature::~TCreature(void){ } if(this->LoseInventory != 0){ // LOSE_INVENTORY_NONE ? - for(int Position = 1; Position <= 10; Position += 1){ + for(int Position = INVENTORY_FIRST; + Position <= INVENTORY_LAST; + Position += 1){ Object Item = GetBodyObject(this->ID, Position); if(Item == NONE){ continue; @@ -238,7 +240,7 @@ TCreature::~TCreature(void){ continue; } - Move(0, Item, Corpse, -1, false, NONE); + ::Move(0, Item, Corpse, -1, false, NONE); } } @@ -487,10 +489,8 @@ int TCreature::Damage(TCreature *Attacker, int Damage, int DamageType){ Damage = 0; } - // NOTE(fusion): We're iterating over the victim's inventory to apply - // damage reductions, while the damage is greater than zero. - for(int Position = 1; - Position <= 10 && Damage > 0; + for(int Position = INVENTORY_FIRST; + Position <= INVENTORY_LAST && Damage > 0; Position += 1){ Object Obj = GetBodyObject(this->ID, Position); if(Obj == NONE){ @@ -739,7 +739,9 @@ int TCreature::Damage(TCreature *Attacker, int Damage, int DamageType){ if(Damage == HitPoints){ if(this->Type == PLAYER){ - for(int Position = 1; Position <= 10; Position += 1){ + for(int Position = INVENTORY_FIRST; + Position <= INVENTORY_LAST; + Position += 1){ Object Obj = GetBodyObject(this->ID, Position); if(Obj == NONE){ continue; @@ -2026,11 +2028,11 @@ void ProcessMonsterRaids(void){ } TCreature *Creature = Spawned[random(0, NumSpawned - 1)]; - Object Bag = GetBodyObject(Creature->ID, 3); // BAG ? + Object Bag = GetBodyObject(Creature->ID, INVENTORY_BAG); if(Bag == NONE){ try{ - Bag = Create(GetBodyContainer(Creature->ID, 3), - GetSpecialObject(INVENTORY_CONTAINER), + Bag = Create(GetBodyContainer(Creature->ID, INVENTORY_BAG), + GetSpecialObject(DEFAULT_CONTAINER), 0); }catch(RESULT r){ error("ProcessMonsterRaids: Exception %d bei Rasse %d" |
