mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[9911] Check script using and existance at creature_movement_scripts load.
This commit is contained in:
parent
0828c3aa81
commit
112afc260c
5 changed files with 45 additions and 10 deletions
|
|
@ -4583,6 +4583,16 @@ void ObjectMgr::LoadGossipScripts()
|
|||
void ObjectMgr::LoadCreatureMovementScripts()
|
||||
{
|
||||
LoadScripts(sCreatureMovementScripts, "creature_movement_scripts");
|
||||
|
||||
std::set<uint32> ids;
|
||||
|
||||
for(ScriptMapMap::const_iterator itr = sCreatureMovementScripts.begin(); itr != sEventScripts.end(); ++itr)
|
||||
ids.insert(itr->first);
|
||||
|
||||
sWaypointMgr.CheckScriptExistance(ids);
|
||||
|
||||
for(std::set<uint32>::const_iterator itr = ids.begin(); itr != ids.end(); ++itr)
|
||||
sLog.outErrorDb("Table `creature_movement_scripts` has script (Id: %u) not referring to any waypoint.", *itr);
|
||||
}
|
||||
|
||||
void ObjectMgr::LoadPageTexts()
|
||||
|
|
@ -8446,7 +8456,7 @@ uint32 ObjectMgr::GetScriptId(const char *name)
|
|||
return uint32(itr - m_scriptNames.begin());
|
||||
}
|
||||
|
||||
void ObjectMgr::CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids)
|
||||
void ObjectMgr::CheckScriptTexts(ScriptMapMap const& scripts,std::set<int32>& ids)
|
||||
{
|
||||
for(ScriptMapMap::const_iterator itrMM = scripts.begin(); itrMM != scripts.end(); ++itrMM)
|
||||
{
|
||||
|
|
@ -8477,13 +8487,13 @@ void ObjectMgr::LoadDbScriptStrings()
|
|||
if(GetMangosStringLocale(i))
|
||||
ids.insert(i);
|
||||
|
||||
CheckScripts(sQuestEndScripts,ids);
|
||||
CheckScripts(sQuestStartScripts,ids);
|
||||
CheckScripts(sSpellScripts,ids);
|
||||
CheckScripts(sGameObjectScripts,ids);
|
||||
CheckScripts(sEventScripts,ids);
|
||||
CheckScripts(sGossipScripts,ids);
|
||||
CheckScripts(sCreatureMovementScripts,ids);
|
||||
CheckScriptTexts(sQuestEndScripts,ids);
|
||||
CheckScriptTexts(sQuestStartScripts,ids);
|
||||
CheckScriptTexts(sSpellScripts,ids);
|
||||
CheckScriptTexts(sGameObjectScripts,ids);
|
||||
CheckScriptTexts(sEventScripts,ids);
|
||||
CheckScriptTexts(sGossipScripts,ids);
|
||||
CheckScriptTexts(sCreatureMovementScripts,ids);
|
||||
|
||||
sWaypointMgr.CheckTextsExistance(ids);
|
||||
|
||||
|
|
|
|||
|
|
@ -961,7 +961,7 @@ class ObjectMgr
|
|||
|
||||
private:
|
||||
void LoadScripts(ScriptMapMap& scripts, char const* tablename);
|
||||
void CheckScripts(ScriptMapMap const& scripts,std::set<int32>& ids);
|
||||
void CheckScriptTexts(ScriptMapMap const& scripts,std::set<int32>& ids);
|
||||
void LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment);
|
||||
void ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const* table, char const* guidEntryStr);
|
||||
void LoadQuestRelationsHelper(QuestRelations& map,char const* table);
|
||||
|
|
|
|||
|
|
@ -394,3 +394,27 @@ void WaypointManager::CheckTextsExistance(std::set<int32>& ids)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WaypointManager::CheckScriptExistance(std::set<uint32>& ids)
|
||||
{
|
||||
WaypointPathMap::iterator pmItr = m_pathMap.begin();
|
||||
for ( ; pmItr != m_pathMap.end(); ++pmItr)
|
||||
{
|
||||
for (size_t i = 0; i < pmItr->second.size(); ++i)
|
||||
{
|
||||
uint32 script_id = pmItr->second[i].script_id;
|
||||
if (!script_id)
|
||||
continue;
|
||||
|
||||
// Now we check text existence and put all zero texts ids to the end of array
|
||||
if (sCreatureMovementScripts.find(script_id)==sCreatureMovementScripts.end())
|
||||
{
|
||||
sLog.outErrorDb("Some waypoint has not existing scriptid %u.", script_id);
|
||||
pmItr->second[i].script_id = 0;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
ids.erase(script_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ class WaypointManager
|
|||
void SetNodePosition(uint32 id, uint32 point, float x, float y, float z);
|
||||
void SetNodeText(uint32 id, uint32 point, const char *text_field, const char *text);
|
||||
void CheckTextsExistance(std::set<int32>& ids);
|
||||
void CheckScriptExistance(std::set<uint32>& ids);
|
||||
|
||||
private:
|
||||
void _addNode(uint32 id, uint32 point, float x, float y, float z, float o, uint32 delay, uint32 wpGuid);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9910"
|
||||
#define REVISION_NR "9911"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue