diff options
author | megamage <none@none> | 2009-02-26 20:43:35 -0600 |
---|---|---|
committer | megamage <none@none> | 2009-02-26 20:43:35 -0600 |
commit | d3a69006675bb5317fab76584d5990b36c2fd5a5 (patch) | |
tree | 8a0f3e0033eb694d5aba06db5c1ecc02b690099e /src/game/Object.cpp | |
parent | 39c513776c5dde8b5732df5ba2467d9e9e3e84fd (diff) | |
parent | bc54e91afff9b9a53902439441fa2e63e3da1a9a (diff) |
*Merge.
--HG--
branch : trunk
Diffstat (limited to 'src/game/Object.cpp')
-rw-r--r-- | src/game/Object.cpp | 43 |
1 files changed, 33 insertions, 10 deletions
diff --git a/src/game/Object.cpp b/src/game/Object.cpp index 272de775195..080a6af41de 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1103,19 +1103,42 @@ WorldObject::WorldObject() m_isActive = false; } -void WorldObject::setActive(bool isActive) +void WorldObject::SetWorldObject(bool on) { - // if already in the same activity state as we try to set, do nothing - if(isActive == m_isActive || isType(TYPEMASK_PLAYER)) + if(!IsInWorld()) + return; + + GetMap()->AddObjectToSwitchList(this, on); +} + +void WorldObject::setActive( bool on ) +{ + if(m_isActive==on) + return; + + if(GetTypeId() == TYPEID_PLAYER) return; - m_isActive = isActive; - if(IsInWorld()) + bool world = IsInWorld(); + + Map* map; + if(world) { - if(isActive) - GetMap()->AddActiveObject(this); - else - GetMap()->RemoveActiveObject(this); + map = GetMap(); + if(GetTypeId() == TYPEID_UNIT) + map->RemoveFromActive((Creature*)this); + else if(GetTypeId() == TYPEID_DYNAMICOBJECT) + map->RemoveFromActive((DynamicObject*)this); + } + + m_isActive = on; + + if(world) + { + if(GetTypeId() == TYPEID_UNIT) + map->AddToActive((Creature*)this); + else if(GetTypeId() == TYPEID_DYNAMICOBJECT) + map->AddToActive((DynamicObject*)this); } } @@ -1540,7 +1563,7 @@ Map const* WorldObject::GetBaseMap() const void WorldObject::AddObjectToRemoveList() { - Map* map = GetMap(); + Map* map = MapManager::Instance().FindMap(GetMapId(), GetInstanceId()); if(!map) { sLog.outError("Object (TypeId: %u Entry: %u GUID: %u) at attempt add to move list not have valid map (Id: %u).",GetTypeId(),GetEntry(),GetGUIDLow(),GetMapId()); |