aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2016-05-15 00:04:06 +0200
committerShauren <shauren.trinity@gmail.com>2016-05-15 00:04:06 +0200
commit7a806595ee916bef13783d12e0fbee4df0ff804b (patch)
treec6249a27b09d26a6de8a2c3de5bcda2cc302dbec /src
parent0139d83e28a7daa8cf8675ba9403241a92821071 (diff)
Core/DataStores: Defined ChrSpecialization flag values
Diffstat (limited to 'src')
-rw-r--r--src/server/game/DataStores/DBCEnums.h11
-rw-r--r--src/server/game/DataStores/DBCStores.cpp17
-rw-r--r--src/server/game/DataStores/DBCStores.h3
3 files changed, 27 insertions, 4 deletions
diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h
index 327c8cac081..710e92ca712 100644
--- a/src/server/game/DataStores/DBCEnums.h
+++ b/src/server/game/DataStores/DBCEnums.h
@@ -137,6 +137,17 @@ enum AreaFlags
AREA_FLAG_UNK9 = 0x40000000
};
+enum ChrSpecializationFlag
+{
+ CHR_SPECIALIZATION_FLAG_CASTER = 0x01,
+ CHR_SPECIALIZATION_FLAG_RANGED = 0x02,
+ CHR_SPECIALIZATION_FLAG_MELEE = 0x04,
+ CHR_SPECIALIZATION_FLAG_UNKNOWN = 0x08,
+ CHR_SPECIALIZATION_FLAG_DUAL_WIELD_TWO_HANDED = 0x10, // used for CUnitDisplay::SetSheatheInvertedForDualWield
+ CHR_SPECIALIZATION_FLAG_PET_OVERRIDE_SPEC = 0x20,
+ CHR_SPECIALIZATION_FLAG_RECOMMENDED = 0x40,
+};
+
enum CriteriaCondition
{
CRITERIA_CONDITION_NONE = 0,
diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp
index 0f16acb3df3..79c42c4fc7b 100644
--- a/src/server/game/DataStores/DBCStores.cpp
+++ b/src/server/game/DataStores/DBCStores.cpp
@@ -389,9 +389,20 @@ void LoadDBCStores(const std::string& dataPath, uint32 defaultLocale)
sCharSectionMap.insert({ entry->GenType | (entry->Gender << 8) | (entry->Race << 16), entry });
memset(sChrSpecializationByIndexStore, 0, sizeof(sChrSpecializationByIndexStore));
- for (uint32 i = 0; i < sChrSpecializationStore.GetNumRows(); ++i)
- if (ChrSpecializationEntry const* chrSpec = sChrSpecializationStore.LookupEntry(i))
- sChrSpecializationByIndexStore[chrSpec->ClassID][chrSpec->OrderIndex] = chrSpec;
+ for (ChrSpecializationEntry const* chrSpec : sChrSpecializationStore)
+ {
+ ASSERT(chrSpec->ClassID < MAX_CLASSES);
+ ASSERT(chrSpec->OrderIndex < MAX_SPECIALIZATIONS);
+
+ uint32 storageIndex = chrSpec->ClassID;
+ if (chrSpec->Flags & CHR_SPECIALIZATION_FLAG_PET_OVERRIDE_SPEC)
+ {
+ ASSERT(!chrSpec->ClassID);
+ storageIndex = PET_SPEC_OVERRIDE_CLASS_INDEX;
+ }
+
+ sChrSpecializationByIndexStore[storageIndex][chrSpec->OrderIndex] = chrSpec;
+ }
ASSERT(MAX_DIFFICULTY >= sDifficultyStore.GetNumRows(),
"MAX_DIFFICULTY is not large enough to contain all difficulties! (current value %d, required %d)",
diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h
index 0d162cec961..4ab1769c69f 100644
--- a/src/server/game/DataStores/DBCStores.h
+++ b/src/server/game/DataStores/DBCStores.h
@@ -34,7 +34,8 @@ TC_GAME_API char const* GetClassName(uint8 class_, uint8 locale);
TC_GAME_API char const* GetRaceName(uint8 race, uint8 locale);
// ChrSpecialization
-typedef ChrSpecializationEntry const* ChrSpecializationByIndexArray[MAX_CLASSES][MAX_SPECIALIZATIONS];
+#define PET_SPEC_OVERRIDE_CLASS_INDEX MAX_CLASSES
+typedef ChrSpecializationEntry const* ChrSpecializationByIndexArray[MAX_CLASSES + 1][MAX_SPECIALIZATIONS];
// CreatureFamilty
TC_GAME_API char const* GetCreatureFamilyPetName(uint32 petfamily, uint32 locale);