[10535] Add optional argument to SummonCreature, summon as active object

When true, the summoned will be able to load grids as needed.

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-09-25 13:16:59 +02:00
parent b531bcfee1
commit 88fca158f8
3 changed files with 6 additions and 3 deletions

View file

@ -1697,7 +1697,7 @@ void WorldObject::AddObjectToRemoveList()
GetMap()->AddObjectToRemoveList(this); GetMap()->AddObjectToRemoveList(this);
} }
Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime) Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime, bool asActiveObject)
{ {
TemporarySummon* pCreature = new TemporarySummon(GetObjectGuid()); TemporarySummon* pCreature = new TemporarySummon(GetObjectGuid());
@ -1724,6 +1724,9 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
return NULL; return NULL;
} }
// Active state set before added to map
pCreature->SetActiveObjectState(asActiveObject);
pCreature->Summon(spwtype, despwtime); pCreature->Summon(spwtype, despwtime);
if(GetTypeId()==TYPEID_UNIT && ((Creature*)this)->AI()) if(GetTypeId()==TYPEID_UNIT && ((Creature*)this)->AI())

View file

@ -486,7 +486,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
void RemoveFromClientUpdateList(); void RemoveFromClientUpdateList();
void BuildUpdateData(UpdateDataMapType &); void BuildUpdateData(UpdateDataMapType &);
Creature* SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime); Creature* SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime, bool asActiveObject = false);
bool isActiveObject() const { return m_isActiveObject || m_viewPoint.hasViewers(); } bool isActiveObject() const { return m_isActiveObject || m_viewPoint.hasViewers(); }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "10534" #define REVISION_NR "10535"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__