aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Globals/ObjectMgr.cpp
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2017-06-02 03:24:27 -0300
committerariel- <ariel-@users.noreply.github.com>2017-06-02 04:17:29 -0300
commitd56a28afee19741c582ed8e16dbf8e30311f68ea (patch)
tree3a39aab962551199f30c89fe347870ed13f80d74 /src/server/game/Globals/ObjectMgr.cpp
parent0c6829f7f22f32e602ea6ed440d50f2f596ba998 (diff)
Core/Globals: add more AIName and MovementType checks to ObjectMgr
- Ninja fix AI factories (restores prev behaviour of not selecting stuff with PERMIT_BASE_NO) Closes #19831
Diffstat (limited to 'src/server/game/Globals/ObjectMgr.cpp')
-rw-r--r--src/server/game/Globals/ObjectMgr.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp
index 82f3e46ab82..fbb238f8084 100644
--- a/src/server/game/Globals/ObjectMgr.cpp
+++ b/src/server/game/Globals/ObjectMgr.cpp
@@ -23,8 +23,10 @@
#include "BattlegroundMgr.h"
#include "Chat.h"
#include "Common.h"
+#include "CreatureAIFactory.h"
#include "DatabaseEnv.h"
#include "DisableMgr.h"
+#include "GameObjectAIFactory.h"
#include "GossipDef.h"
#include "GroupMgr.h"
#include "GuildMgr.h"
@@ -802,6 +804,12 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
ok = true;
}
+ if (!cInfo->AIName.empty() && !sCreatureAIRegistry->HasItem(cInfo->AIName))
+ {
+ TC_LOG_ERROR("sql.sql", "Creature (Entry: %u) has non-registered `AIName` '%s' set, removing", cInfo->Entry, cInfo->AIName.c_str());
+ const_cast<CreatureTemplate*>(cInfo)->AIName.clear();
+ }
+
FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(cInfo->faction);
if (!factionTemplate)
{
@@ -1834,6 +1842,12 @@ void ObjectMgr::LoadCreatures()
TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u Entry: %u) with `creature_template`.`flags_extra` including CREATURE_FLAG_EXTRA_INSTANCE_BIND but creature is not in instance.", guid, data.id);
}
+ if (data.movementType >= MAX_DB_MOTION_TYPE)
+ {
+ TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u Entry: %u) with wrong movement generator type (%u), ignored and set to IDLE.", guid, data.id, data.movementType);
+ data.movementType = IDLE_MOTION_TYPE;
+ }
+
if (data.spawndist < 0.0f)
{
TC_LOG_ERROR("sql.sql", "Table `creature` has creature (GUID: %u Entry: %u) with `spawndist`< 0, set to 0.", guid, data.id);
@@ -6688,6 +6702,11 @@ void ObjectMgr::LoadGameObjectTemplate()
got.ScriptId = GetScriptId(fields[33].GetString());
// Checks
+ if (!got.AIName.empty() && !sGameObjectAIRegistry->HasItem(got.AIName))
+ {
+ TC_LOG_ERROR("sql.sql", "GameObject (Entry: %u) has non-registered `AIName` '%s' set, removing", got.entry, got.AIName.c_str());
+ got.AIName.clear();
+ }
switch (got.type)
{