diff options
| author | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-10-04 03:29:04 +0200 |
|---|---|---|
| committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-10-04 03:29:04 +0200 |
| commit | 339ddf5e83d6d1839dde87033b29e82a677c37b4 (patch) | |
| tree | 42f3f185919592c0f935c0af0ee7d50068e8538f /src/server/game/AI/SmartScripts | |
| parent | 10e8a110e6f92d4b938eab5004a78a344e9183dc (diff) | |
| parent | b33695a2efe9401548faec150c677209858549e8 (diff) | |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Diffstat (limited to 'src/server/game/AI/SmartScripts')
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 34 | ||||
| -rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.h | 2 |
2 files changed, 10 insertions, 26 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index b57b8b698ea..5cb8c1c4ef0 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -704,29 +704,8 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) { if (e.GetScriptType() == SMART_SCRIPT_TYPE_CREATURE) { - uint32 entry = 0; - if (e.entryOrGuid >= 0) - entry = e.entryOrGuid; - else - { - if (CreatureData const* creatureData = sObjectMgr->GetCreatureData(uint32(abs(e.entryOrGuid)))) - entry = creatureData->id; - } - - CreatureTextMap::const_iterator sList = sCreatureTextMgr->GetTextMap().find(entry); - if (sList == sCreatureTextMgr->GetTextMap().end()) - { - TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u could not find Text for Creature %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), entry); - return false; - } - - CreatureTextHolder const& textHolder = sList->second; - CreatureTextHolder::const_iterator itr = textHolder.find(e.action.talk.textGroupID); - if (itr == textHolder.end()) - { - TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u could not find TextGroup %u for Creature %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.talk.textGroupID, entry); + if (!IsTextValid(e, e.action.talk.textGroupID)) return false; - } } break; } @@ -1207,13 +1186,15 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) return true; } -/*bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id) // unused +bool SmartAIMgr::IsTextValid(SmartScriptHolder const& e, uint32 id) // unused { bool error = false; uint32 entry = 0; + if (e.entryOrGuid >= 0) entry = uint32(e.entryOrGuid); - else { + else + { entry = uint32(abs(e.entryOrGuid)); CreatureData const* data = sObjectMgr->GetCreatureData(entry); if (!data) @@ -1224,15 +1205,18 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) else entry = data->id; } + if (!entry || !sCreatureTextMgr->TextExist(entry, uint8(id))) error = true; + if (error) { TC_LOG_ERROR("sql.sql", "SmartAIMgr: Entry %d SourceType %u Event %u Action %u using non-existent Text id %d, skipped.", e.entryOrGuid, e.GetScriptType(), e.source_type, e.GetActionType(), id); return false; } + return true; -}*/ +} void SmartAIMgr::LoadHelperStores() { diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index 51105d5b433..bdd1dfc6ae0 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -1614,7 +1614,7 @@ class SmartAIMgr return true; } - //bool IsTextValid(SmartScriptHolder const& e, uint32 id); + bool IsTextValid(SmartScriptHolder const& e, uint32 id); // Helpers void LoadHelperStores(); |
