aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/ObjectAccessor.cpp11
-rw-r--r--src/game/ObjectMgr.cpp8
-rw-r--r--src/game/Pet.h2
-rw-r--r--src/game/Player.h2
-rw-r--r--src/game/SpellEffects.cpp3
-rw-r--r--src/game/Totem.cpp20
6 files changed, 32 insertions, 14 deletions
diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp
index 631ccc7fe6b..39687e27e49 100644
--- a/src/game/ObjectAccessor.cpp
+++ b/src/game/ObjectAccessor.cpp
@@ -533,10 +533,15 @@ ObjectAccessor::Update(uint32 diff)
// clone the active object list, because update might remove from it
std::set<WorldObject *> activeobjects(i_activeobjects);
- std::set<WorldObject *>::const_iterator itr;
- for(itr = activeobjects.begin(); itr != activeobjects.end(); ++itr)
+ std::set<WorldObject *>::iterator itr, next;
+ for(itr = activeobjects.begin(); itr != activeobjects.end(); itr = next)
{
- (*itr)->GetMap()->resetMarkedCells();
+ next = itr;
+ ++next;
+ if((*itr)->IsInWorld())
+ (*itr)->GetMap()->resetMarkedCells();
+ else
+ activeobjects.erase(itr);
}
Map *map;
diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp
index 0d290c26876..38926c8cef0 100644
--- a/src/game/ObjectMgr.cpp
+++ b/src/game/ObjectMgr.cpp
@@ -711,22 +711,22 @@ void ObjectMgr::LoadCreatureTemplates()
sLog.outErrorDb("Creature (Entry: %u) has non-existing faction_H template (%u)", cInfo->Entry, cInfo->faction_H);
// check model ids, supplying and sending non-existent ids to the client might crash them
- if(!sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid1))
+ if(cInfo->Modelid1 && !sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid1))
{
sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_A (%u), setting it to 0", cInfo->Entry, cInfo->Modelid1);
const_cast<CreatureInfo*>(cInfo)->Modelid1 = 0;
}
- if(!sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid2))
+ if(cInfo->Modelid2 && !sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid2))
{
sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_A2 (%u), setting it to 0", cInfo->Entry, cInfo->Modelid2);
const_cast<CreatureInfo*>(cInfo)->Modelid2 = 0;
}
- if(!sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid3))
+ if(cInfo->Modelid3 && !sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid3))
{
sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_H (%u), setting it to 0", cInfo->Entry, cInfo->Modelid3);
const_cast<CreatureInfo*>(cInfo)->Modelid3 = 0;
}
- if(!sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid4))
+ if(cInfo->Modelid4 && !sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->Modelid4))
{
sLog.outErrorDb("Creature (Entry: %u) has non-existing modelId_H2 (%u), setting it to 0", cInfo->Entry, cInfo->Modelid4);
const_cast<CreatureInfo*>(cInfo)->Modelid4 = 0;
diff --git a/src/game/Pet.h b/src/game/Pet.h
index e5beb3a3883..c34f06f2ccc 100644
--- a/src/game/Pet.h
+++ b/src/game/Pet.h
@@ -122,8 +122,6 @@ class Pet : public Creature
void AddToWorld();
void RemoveFromWorld();
- // always active
- void setActive() {}
PetType getPetType() const { return m_petType; }
void setPetType(PetType type) { m_petType = type; }
diff --git a/src/game/Player.h b/src/game/Player.h
index 0b927c60dfc..79929bf4c27 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -903,7 +903,7 @@ class TRINITY_DLL_SPEC Player : public Unit
void AddToWorld();
void RemoveFromWorld();
// always active
- void setActive() {}
+ void setActive(bool) {}
bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options = 0);
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 25454f41462..4783724d025 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -3108,6 +3108,7 @@ void Spell::EffectSummon(uint32 i)
return;
uint32 level = m_caster->getLevel();
Pet* spawnCreature = new Pet(SUMMON_PET);
+ spawnCreature->setActive(m_caster->isActive());
if(spawnCreature->LoadPetFromDB(m_caster,pet_entry))
{
@@ -3543,6 +3544,7 @@ void Spell::EffectSummonGuardian(uint32 i)
for(int32 count = 0; count < amount; ++count)
{
Pet* spawnCreature = new Pet(GUARDIAN_PET);
+ spawnCreature->setActive(m_caster->isActive());
Map *map = m_caster->GetMap();
uint32 pet_number = objmgr.GeneratePetNumber();
@@ -3937,6 +3939,7 @@ void Spell::EffectSummonPet(uint32 i)
}
Pet* NewSummon = new Pet;
+ NewSummon->setActive(m_caster->isActive());
// petentry==0 for hunter "call pet" (current pet summoned if any)
if(NewSummon->LoadPetFromDB(m_caster,petentry))
diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp
index f1629d4e6a2..4f8b03827ae 100644
--- a/src/game/Totem.cpp
+++ b/src/game/Totem.cpp
@@ -59,13 +59,25 @@ void Totem::Summon(Unit* owner)
CreatureInfo const *cinfo = GetCreatureInfo();
if (owner->GetTypeId()==TYPEID_PLAYER && cinfo)
{
- if (uint32 modelid = cinfo->GetRandomValidModelId())
- SetDisplayId(modelid);
+ uint32 modelid = 0;
+ if(((Player*)owner)->GetTeam() == HORDE)
+ {
+ if(cinfo->Modelid3)
+ modelid = cinfo->Modelid3;
+ else if(cinfo->Modelid4)
+ modelid = cinfo->Modelid4;
+ }
else
{
- sLog.outErrorDb("No displayid found for the totem with the entry %u! Can't summon it!", GetEntry());
- return;
+ if(cinfo->Modelid1)
+ modelid = cinfo->Modelid1;
+ else if(cinfo->Modelid2)
+ modelid = cinfo->Modelid2;
}
+ if (modelid)
+ SetDisplayId(modelid);
+ else
+ sLog.outErrorDb("Totem::Summon: Missing modelid information for entry %u, team %u, totem will use default values.",GetEntry(),((Player*)owner)->GetTeam());
}
// Only add if a display exists.