From 3cc587ab8df80d42d9dab1a73a37701f565a3499 Mon Sep 17 00:00:00 2001 From: fusion32 Date: Sun, 15 Jun 2025 17:35:06 -0300 Subject: more work on `operate.cc` --- src/crmain.cc | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) (limited to 'src/crmain.cc') diff --git a/src/crmain.cc b/src/crmain.cc index 7e0ab42..c6a8b74 100644 --- a/src/crmain.cc +++ b/src/crmain.cc @@ -719,9 +719,13 @@ int TCreature::Damage(TCreature *Attacker, int Damage, int DamageType){ GraphicalEffect(this->CrObject, HitEffect); TextualEffect(this->CrObject, TextColor, "%d", Damage); if(SplashLiquid != LIQUID_NONE){ - CreatePool(GetMapContainer(this->CrObject), - GetSpecialObject(BLOOD_SPLASH), - SplashLiquid); + try{ + CreatePool(GetMapContainer(this->CrObject), + GetSpecialObject(BLOOD_SPLASH), + SplashLiquid); + }catch(RESULT r){ + // TODO(fusion): Ignore? + } } } @@ -754,10 +758,15 @@ int TCreature::Damage(TCreature *Attacker, int Damage, int DamageType){ if(ObjType == AmuletOfLossType){ Log("game", "%s stirbt mit Amulett of Loss.\n", this->Name); this->LoseInventory = 0; - Delete(Obj, -1); - // TODO(fusion): Shouldn't we break here? We could also - // just check if there is an amulet of loss in the necklace - // container instead of iterating over all of them. + try{ + Delete(Obj, -1); + // TODO(fusion): Shouldn't we break here? We could also + // just check if there is an amulet of loss in the necklace + // container instead of iterating over all inventory. + }catch(RESULT r){ + error("TCreature::Damage: Exception %d beim Löschen von Objekt %d.\n", + r, AmuletOfLossType.TypeID); + } } } } -- cgit v1.2.3