mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[10278] Reserve space for EventAIHolder container
This commit is contained in:
parent
61d076442f
commit
5d0b9d2808
2 changed files with 28 additions and 6 deletions
|
|
@ -58,9 +58,9 @@ CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c)
|
|||
CreatureEventAI_Event_Map::const_iterator creatureEventsItr = sEventAIMgr.GetCreatureEventAIMap().find(m_creature->GetEntry());
|
||||
if (creatureEventsItr != sEventAIMgr.GetCreatureEventAIMap().end())
|
||||
{
|
||||
uint32 events_count = 0;
|
||||
for (CreatureEventAI_Event_Vec::const_iterator i = (*creatureEventsItr).second.begin(); i != (*creatureEventsItr).second.end(); ++i)
|
||||
{
|
||||
|
||||
//Debug check
|
||||
#ifndef MANGOS_DEBUG
|
||||
if ((*i).event_flags & EFLAG_DEBUG_ONLY)
|
||||
|
|
@ -70,16 +70,38 @@ CreatureEventAI::CreatureEventAI(Creature *c ) : CreatureAI(c)
|
|||
{
|
||||
if ((1 << (m_creature->GetMap()->GetSpawnMode()+1)) & (*i).event_flags)
|
||||
{
|
||||
//event flagged for instance mode
|
||||
m_CreatureEventAIList.push_back(CreatureEventAIHolder(*i));
|
||||
++events_count;
|
||||
}
|
||||
}
|
||||
else
|
||||
m_CreatureEventAIList.push_back(CreatureEventAIHolder(*i));
|
||||
++events_count;
|
||||
}
|
||||
//EventMap had events but they were not added because they must be for instance
|
||||
if (m_CreatureEventAIList.empty())
|
||||
if (events_count == 0)
|
||||
sLog.outError("CreatureEventAI: Creature %u has events but no events added to list because of instance flags.", m_creature->GetEntry());
|
||||
else
|
||||
{
|
||||
m_CreatureEventAIList.reserve(events_count);
|
||||
for (CreatureEventAI_Event_Vec::const_iterator i = (*creatureEventsItr).second.begin(); i != (*creatureEventsItr).second.end(); ++i)
|
||||
{
|
||||
|
||||
//Debug check
|
||||
#ifndef MANGOS_DEBUG
|
||||
if ((*i).event_flags & EFLAG_DEBUG_ONLY)
|
||||
continue;
|
||||
#endif
|
||||
if (m_creature->GetMap()->IsDungeon())
|
||||
{
|
||||
if ((1 << (m_creature->GetMap()->GetSpawnMode()+1)) & (*i).event_flags)
|
||||
{
|
||||
//event flagged for instance mode
|
||||
m_CreatureEventAIList.push_back(CreatureEventAIHolder(*i));
|
||||
}
|
||||
}
|
||||
else
|
||||
m_CreatureEventAIList.push_back(CreatureEventAIHolder(*i));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
sLog.outError("CreatureEventAI: EventMap for Creature %u is empty but creature is using CreatureEventAI.", m_creature->GetEntry());
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10277"
|
||||
#define REVISION_NR "10278"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue