aboutsummaryrefslogtreecommitdiff
path: root/src/magic.cc
diff options
context:
space:
mode:
authorfusion32 <marcopuzziello@gmail.com>2025-09-04 22:28:43 -0300
committerfusion32 <marcopuzziello@gmail.com>2025-09-04 22:28:43 -0300
commit8d565e911691a3740c283bd33ebc11d6d0fac6b7 (patch)
treebe1b47836834e018d6670cd3d36d4a9aebc3ea6b /src/magic.cc
parent9b2292bdce7667c1a32e478925ee28b8f71b8f35 (diff)
downloadgame-8d565e911691a3740c283bd33ebc11d6d0fac6b7.tar.gz
game-8d565e911691a3740c283bd33ebc11d6d0fac6b7.zip
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`.
Diffstat (limited to 'src/magic.cc')
-rw-r--r--src/magic.cc12
1 files changed, 9 insertions, 3 deletions
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){