mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[11819] move SetActiveObjectState to WorldObject level
This commit is contained in:
parent
012be82c86
commit
df0715284f
7 changed files with 23 additions and 29 deletions
|
|
@ -2403,26 +2403,6 @@ void Creature::ClearTemporaryFaction()
|
||||||
setFaction(GetCreatureInfo()->faction_A);
|
setFaction(GetCreatureInfo()->faction_A);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Creature::SetActiveObjectState( bool on )
|
|
||||||
{
|
|
||||||
if(m_isActiveObject==on)
|
|
||||||
return;
|
|
||||||
|
|
||||||
bool world = IsInWorld();
|
|
||||||
|
|
||||||
Map* map;
|
|
||||||
if(world)
|
|
||||||
{
|
|
||||||
map = GetMap();
|
|
||||||
map->Remove(this,false);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_isActiveObject = on;
|
|
||||||
|
|
||||||
if(world)
|
|
||||||
map->Add(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Creature::SendAreaSpiritHealerQueryOpcode(Player *pl)
|
void Creature::SendAreaSpiritHealerQueryOpcode(Player *pl)
|
||||||
{
|
{
|
||||||
uint32 next_resurrect = 0;
|
uint32 next_resurrect = 0;
|
||||||
|
|
|
||||||
|
|
@ -682,8 +682,6 @@ class MANGOS_DLL_SPEC Creature : public Unit
|
||||||
|
|
||||||
void SetDeadByDefault (bool death_state) { m_isDeadByDefault = death_state; }
|
void SetDeadByDefault (bool death_state) { m_isDeadByDefault = death_state; }
|
||||||
|
|
||||||
void SetActiveObjectState(bool on);
|
|
||||||
|
|
||||||
void SetFactionTemporary(uint32 factionId, uint32 tempFactionFlags = TEMPFACTION_ALL);
|
void SetFactionTemporary(uint32 factionId, uint32 tempFactionFlags = TEMPFACTION_ALL);
|
||||||
void ClearTemporaryFaction();
|
void ClearTemporaryFaction();
|
||||||
uint32 GetTemporaryFactionFlags() { return m_temporaryFactionFlags; }
|
uint32 GetTemporaryFactionFlags() { return m_temporaryFactionFlags; }
|
||||||
|
|
|
||||||
|
|
@ -1081,6 +1081,8 @@ bool Map::ActiveObjectsNearGrid(uint32 x, uint32 y) const
|
||||||
void Map::AddToActive( WorldObject* obj )
|
void Map::AddToActive( WorldObject* obj )
|
||||||
{
|
{
|
||||||
m_activeNonPlayers.insert(obj);
|
m_activeNonPlayers.insert(obj);
|
||||||
|
Cell cell = Cell(MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()));
|
||||||
|
EnsureGridLoaded(cell);
|
||||||
|
|
||||||
// also not allow unloading spawn grid to prevent creating creature clone at load
|
// also not allow unloading spawn grid to prevent creating creature clone at load
|
||||||
if (obj->GetTypeId() == TYPEID_UNIT)
|
if (obj->GetTypeId() == TYPEID_UNIT)
|
||||||
|
|
|
||||||
|
|
@ -1879,3 +1879,18 @@ bool WorldObject::PrintCoordinatesError(float x, float y, float z, char const* d
|
||||||
sLog.outError("%s with invalid %s coordinates: mapid = %uu, x = %f, y = %f, z = %f", GetGuidStr().c_str(), descr, GetMapId(), x, y, z);
|
sLog.outError("%s with invalid %s coordinates: mapid = %uu, x = %f, y = %f, z = %f", GetGuidStr().c_str(), descr, GetMapId(), x, y, z);
|
||||||
return false; // always false for continue assert fail
|
return false; // always false for continue assert fail
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WorldObject::SetActiveObjectState(bool active)
|
||||||
|
{
|
||||||
|
if (m_isActiveObject == active || (isType(TYPEMASK_PLAYER) && !active)) // player shouldn't became inactive, never
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (IsInWorld())
|
||||||
|
{
|
||||||
|
if (isActiveObject() && !active)
|
||||||
|
GetMap()->RemoveFromActive(this);
|
||||||
|
else if (!isActiveObject() && active)
|
||||||
|
GetMap()->AddToActive(this);
|
||||||
|
}
|
||||||
|
m_isActiveObject = active;
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -580,6 +580,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
||||||
Creature* SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime, bool asActiveObject = false);
|
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(); }
|
||||||
|
void SetActiveObjectState(bool active);
|
||||||
|
|
||||||
ViewPoint& GetViewPoint() { return m_viewPoint; }
|
ViewPoint& GetViewPoint() { return m_viewPoint; }
|
||||||
|
|
||||||
|
|
@ -596,7 +597,6 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
||||||
|
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
|
|
||||||
bool m_isActiveObject;
|
|
||||||
private:
|
private:
|
||||||
Map * m_currMap; //current object's Map location
|
Map * m_currMap; //current object's Map location
|
||||||
|
|
||||||
|
|
@ -605,10 +605,9 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
||||||
uint32 m_phaseMask; // in area phase state
|
uint32 m_phaseMask; // in area phase state
|
||||||
|
|
||||||
Position m_position;
|
Position m_position;
|
||||||
|
|
||||||
ViewPoint m_viewPoint;
|
ViewPoint m_viewPoint;
|
||||||
|
|
||||||
WorldUpdateCounter m_updateTracker;
|
WorldUpdateCounter m_updateTracker;
|
||||||
|
bool m_isActiveObject;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,7 @@ Player::Player (WorldSession *session): Unit(), m_mover(this), m_camera(this), m
|
||||||
|
|
||||||
m_valuesCount = PLAYER_END;
|
m_valuesCount = PLAYER_END;
|
||||||
|
|
||||||
m_isActiveObject = true; // player is always active object
|
SetActiveObjectState(true); // player is always active object
|
||||||
|
|
||||||
m_session = session;
|
m_session = session;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11818"
|
#define REVISION_NR "11819"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue