aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorXTZGZoReX <none@none>2010-01-14 18:08:42 +0100
committerXTZGZoReX <none@none>2010-01-14 18:08:42 +0100
commit91ee03d9bf14e17e048c6b162307524845e9ab64 (patch)
treef7c9306a05abf22ae78858b3b354388c9d739486 /src
parent97576c68c4d70f6ce803fb6db436c3b9ca616d1a (diff)
* creature_template.unit_class cannot be 0 - added check for this.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/ObjectMgr.cpp2
-rw-r--r--src/game/SharedDefines.h11
2 files changed, 11 insertions, 2 deletions
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index b762e2bd85f..36be907cbaa 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -691,7 +691,7 @@ void ObjectMgr::LoadCreatureTemplates()
}
}
- if (cInfo->unit_class && ((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0)
+ if (!cInfo->unit_class || ((1 << (cInfo->unit_class-1)) & CLASSMASK_ALL_CREATURES) == 0)
sLog.outErrorDb("Creature (Entry: %u) has invalid unit_class(%u) for creature_template", cInfo->Entry, cInfo->unit_class);
if(cInfo->dmgschool >= MAX_SPELL_SCHOOL)
diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index e80239b3574..a9714359242 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -94,7 +94,16 @@ enum Classes
(1<<(CLASS_MAGE-1)) |(1<<(CLASS_WARLOCK-1))|(1<<(CLASS_DRUID-1)) | \
(1<<(CLASS_DEATH_KNIGHT-1)) )
-#define CLASSMASK_ALL_CREATURES ((1<<(CLASS_WARRIOR-1)) | (1<<(CLASS_PALADIN-1)) | (1<<(CLASS_ROGUE-1)) | (1<<(CLASS_MAGE-1)) )
+// valid classes for creature_template.unit_class
+enum UnitClass
+{
+ UNIT_CLASS_WARRIOR = 1,
+ UNIT_CLASS_PALADIN = 2,
+ UNIT_CLASS_ROGUE = 4,
+ UNIT_CLASS_MAGE = 8,
+};
+
+#define CLASSMASK_ALL_CREATURES ((1<<(UNIT_CLASS_WARRIOR-1)) | (1<<(UNIT_CLASS_PALADIN-1)) | (1<<(UNIT_CLASS_ROGUE-1)) | (1<<(UNIT_CLASS_MAGE-1)) )
#define CLASSMASK_WAND_USERS ((1<<(CLASS_PRIEST-1))|(1<<(CLASS_MAGE-1))|(1<<(CLASS_WARLOCK-1)))