Fix TC build

This commit is contained in:
Rochet2
2015-09-24 11:48:07 +03:00
parent 7ec215b2d7
commit 8daaf04994
8 changed files with 97 additions and 24 deletions

View File

@@ -101,6 +101,22 @@ void Eluna::LoadScriptPaths()
ELUNA_LOG_DEBUG("[Eluna]: Loaded %u scripts in %u ms", uint32(lua_scripts.size() + lua_extensions.size()), ElunaUtil::GetTimeDiff(oldMSTime));
}
#ifdef TRINITY
class ElunaAIUpdateWorker
{
public:
void Visit(std::unordered_map<ObjectGuid, Creature*>& creatureMap)
{
for (auto const& p : creatureMap)
if (p.second->IsInWorld())
p.second->AIM_Initialize();
}
template<class T>
void Visit(std::unordered_map<ObjectGuid, T*>&) { }
};
#endif
void Eluna::_ReloadEluna()
{
LOCK_ELUNA;
@@ -125,12 +141,12 @@ void Eluna::_ReloadEluna()
#ifdef TRINITY
// Re initialize creature AI restoring C++ AI or applying lua AI
sMapMgr->DoForAllMaps([](Map* map)
{
HashMapHolder<Creature>::MapType const m = ObjectAccessor::GetCreatures();
for (HashMapHolder<Creature>::MapType::const_iterator iter = m.begin(); iter != m.end(); ++iter)
if (iter->second->IsInWorld())
iter->second->AIM_Initialize();
}
ElunaAIUpdateWorker worker;
TypeContainerVisitor<ElunaAIUpdateWorker, MapStoredObjectTypesContainer> visitor(worker);
visitor.Visit(map->GetObjectsStore());
});
#endif
reload = false;