From 8d565e911691a3740c283bd33ebc11d6d0fac6b7 Mon Sep 17 00:00:00 2001 From: fusion32 Date: Thu, 4 Sep 2025 22:28:43 -0300 Subject: missing try-catch block in `CreateField` - fixes #21 The result DESTROYED was being caught at `UseMagicItem`, causing the cast to fail but not before partially spawning other fields in the case of `MassCreateField` and `CreateFieldWall`. --- src/magic.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/magic.cc') diff --git a/src/magic.cc b/src/magic.cc index c69507f..c02e0f0 100644 --- a/src/magic.cc +++ b/src/magic.cc @@ -1042,9 +1042,15 @@ void CreateField(int x, int y, int z, int FieldType, uint32 Owner, bool Peaceful } // NOTE(fusion): Create field, at last. - Create(GetMapContainer(x, y, z), - GetSpecialObject(Meaning), - Owner); + try{ + Create(GetMapContainer(x, y, z), + GetSpecialObject(Meaning), + Owner); + }catch(RESULT r){ + if(r != DESTROYED){ + throw; + } + } } void CreateField(TCreature *Actor, Object Target, int ManaPoints, int SoulPoints, int FieldType){ -- cgit v1.2.3