aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/game/DataStores/DBCStructure.h2
-rw-r--r--src/server/game/DataStores/DBCfmt.h2
-rw-r--r--src/server/game/Entities/Creature/Creature.h4
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp46
-rw-r--r--src/server/game/Miscellaneous/SharedDefines.h7
5 files changed, 34 insertions, 27 deletions
diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h
index 3bf632001b0..b3ea9814cf3 100644
--- a/src/server/game/DataStores/DBCStructure.h
+++ b/src/server/game/DataStores/DBCStructure.h
@@ -812,7 +812,7 @@ struct CreatureDisplayInfoEntry
//uint32 ObjectEffectPackageID; // 16
//uint32 AnimReplacementSetID; // 17
//uint32 Flags; // 18
- //uint32 Gender; // 19
+ int32 Gender; // 19
//uint32 StateSpellVisualKitID; // 20
};
diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h
index 867e64ef92e..9f53cb09ad8 100644
--- a/src/server/game/DataStores/DBCfmt.h
+++ b/src/server/game/DataStores/DBCfmt.h
@@ -43,7 +43,7 @@ char const ChrRacesEntryfmt[] = "niixiixxxxxxiisxxxxxxxxxxxxxxxxxxxxxxxxx";
char const ChrClassesXPowerTypesfmt[] = "nii";
char const ChrSpecializationEntryfmt[] = "nxiiiiiiiiixxxii";
char const CinematicSequencesEntryfmt[] = "nxxxxxxxxx";
-char const CreatureDisplayInfofmt[] = "nixifxxxxxxxxxxxxxxxx";
+char const CreatureDisplayInfofmt[] = "nixifxxxxxxxxxxxxxxix";
char const CreatureDisplayInfoExtrafmt[] = "dixxxxxxxxxxxxxxxxxxxx";
char const CreatureFamilyfmt[] = "nfifiiiiixsx";
char const CreatureModelDatafmt[] = "nixxxxxxxxxxxxxffxxxxxxxxxxxxxxxxx";
diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h
index 9acde98a7a8..ef171e311ae 100644
--- a/src/server/game/Entities/Creature/Creature.h
+++ b/src/server/game/Entities/Creature/Creature.h
@@ -287,8 +287,8 @@ struct CreatureModelInfo
{
float bounding_radius;
float combat_reach;
- uint8 gender;
- uint32 modelid_other_gender;
+ int8 gender;
+ uint32 displayId_other_gender;
};
// Benchmarked: Faster than std::map (insert/find)
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 90a40aa7990..5898ba32de7 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -1222,15 +1222,15 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32* display
return NULL;
// If a model for another gender exists, 50% chance to use it
- if (modelInfo->modelid_other_gender != 0 && urand(0, 1) == 0)
+ if (modelInfo->displayId_other_gender != 0 && urand(0, 1) == 0)
{
- CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(modelInfo->modelid_other_gender);
+ CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(modelInfo->displayId_other_gender);
if (!minfo_tmp)
- TC_LOG_ERROR("sql.sql", "Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender);
+ TC_LOG_ERROR("sql.sql", "Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->displayId_other_gender);
else
{
- // Model ID changed
- *displayID = modelInfo->modelid_other_gender;
+ // DisplayID changed
+ *displayID = modelInfo->displayId_other_gender;
return minfo_tmp;
}
}
@@ -1242,7 +1242,7 @@ void ObjectMgr::LoadCreatureModelInfo()
{
uint32 oldMSTime = getMSTime();
- QueryResult result = WorldDatabase.Query("SELECT modelid, bounding_radius, combat_reach, gender, modelid_other_gender FROM creature_model_info");
+ QueryResult result = WorldDatabase.Query("SELECT DisplayID, BoundingRadius, CombatReach, DisplayID_Other_Gender FROM creature_model_info");
if (!result)
{
@@ -1257,30 +1257,36 @@ void ObjectMgr::LoadCreatureModelInfo()
{
Field* fields = result->Fetch();
- uint32 modelId = fields[0].GetUInt32();
+ uint32 displayId = fields[0].GetUInt32();
- CreatureModelInfo& modelInfo = _creatureModelStore[modelId];
+ CreatureDisplayInfoEntry const* creatureDisplay = sCreatureDisplayInfoStore.LookupEntry(displayId);
+ if (!creatureDisplay)
+ {
+ TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has a non-existent DisplayID (ID: %u). Skipped.", displayId);
+ continue;
+ }
- modelInfo.bounding_radius = fields[1].GetFloat();
- modelInfo.combat_reach = fields[2].GetFloat();
- modelInfo.gender = fields[3].GetUInt8();
- modelInfo.modelid_other_gender = fields[4].GetUInt32();
+ CreatureModelInfo& modelInfo = _creatureModelStore[displayId];
- // Checks
+ modelInfo.bounding_radius = fields[1].GetFloat();
+ modelInfo.combat_reach = fields[2].GetFloat();
+ modelInfo.displayId_other_gender = fields[3].GetUInt32();
+ modelInfo.gender = creatureDisplay->Gender;
- if (!sCreatureDisplayInfoStore.LookupEntry(modelId))
- TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has model for nonexistent display id (%u).", modelId);
+ // Checks
- if (modelInfo.gender > GENDER_NONE)
+ // to remove when the purpose of GENDER_UNKNOWN is known
+ if (modelInfo.gender == GENDER_UNKNOWN)
{
- TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has wrong gender (%u) for display id (%u).", uint32(modelInfo.gender), modelId);
+ // We don't need more errors
+ //TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has an unimplemented Gender (ID: %i) being used by DisplayID (ID: %u). Gender set to GENDER_MALE.", modelInfo.gender, modelId);
modelInfo.gender = GENDER_MALE;
}
- if (modelInfo.modelid_other_gender && !sCreatureDisplayInfoStore.LookupEntry(modelInfo.modelid_other_gender))
+ if (modelInfo.displayId_other_gender && !sCreatureDisplayInfoStore.LookupEntry(modelInfo.displayId_other_gender))
{
- TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has nonexistent alt.gender model (%u) for existed display id (%u).", modelInfo.modelid_other_gender, modelId);
- modelInfo.modelid_other_gender = 0;
+ TC_LOG_ERROR("sql.sql", "Table `creature_model_info` has a non-existent DisplayID_Other_Gender (ID: %u) being used by DisplayID (ID: %u).", modelInfo.displayId_other_gender, displayId);
+ modelInfo.displayId_other_gender = 0;
}
if (modelInfo.combat_reach < 0.1f)
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index 68c30716ad9..4c44a4f94a1 100644
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -58,9 +58,10 @@ enum Expansions
enum Gender
{
- GENDER_MALE = 0,
- GENDER_FEMALE = 1,
- GENDER_NONE = 2
+ GENDER_UNKNOWN = -1,
+ GENDER_MALE = 0,
+ GENDER_FEMALE = 1,
+ GENDER_NONE = 2
};
// ChrRaces.dbc (6.0.2.18988)