From 344c5900b8c5f6fbb7b4f853d77a6a0077b70e5c Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sat, 22 Apr 2023 17:52:55 -0500 Subject: [PATCH] added none check to enemy and notEnemy in mobbase --- src/engine/Enum.java | 1 - src/engine/objects/MobBase.java | 11 ++++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/engine/Enum.java b/src/engine/Enum.java index dd92087e..89b0f995 100644 --- a/src/engine/Enum.java +++ b/src/engine/Enum.java @@ -50,7 +50,6 @@ public class Enum { } public enum MonsterType implements EnumBitSetHelper { - None, Aelfborn, All, Animal, diff --git a/src/engine/objects/MobBase.java b/src/engine/objects/MobBase.java index 9182cb78..a479308f 100644 --- a/src/engine/objects/MobBase.java +++ b/src/engine/objects/MobBase.java @@ -109,9 +109,14 @@ public class MobBase extends AbstractGameObject { } this.flags = EnumBitSet.asEnumBitSet(rs.getLong("flags"), Enum.MobFlagType.class); - - this.notEnemy = EnumBitSet.asEnumBitSet(rs.getLong("notEnemy"), Enum.MonsterType.class); - this.enemy = EnumBitSet.asEnumBitSet(rs.getLong("enemy"), Enum.MonsterType.class); + if(rs.getLong("notEnemy") == 0) + this.notEnemy = EnumBitSet.noneOf(Enum.MonsterType.class); + else + this.notEnemy = EnumBitSet.asEnumBitSet(rs.getLong("notEnemy"), Enum.MonsterType.class); + if(rs.getLong("enemy") == 0) + this.enemy = EnumBitSet.noneOf(Enum.MonsterType.class); + else + this.enemy = EnumBitSet.asEnumBitSet(rs.getLong("enemy"), Enum.MonsterType.class); this.seeInvis = rs.getInt("seeInvis"); this.scale = rs.getFloat("scale");