dropped old code, which unused since new visibility system implemented
--HG-- branch : trunk
This commit is contained in:
@@ -154,11 +154,6 @@ VisibleChangesNotifier::Visit(DynamicObjectMapType &m)
|
|||||||
caster->UpdateVisibilityOf(&i_object);
|
caster->UpdateVisibilityOf(&i_object);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
PlayerVisibilityNotifier::Notify()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MessageDistDeliverer::Visit(PlayerMapType &m)
|
MessageDistDeliverer::Visit(PlayerMapType &m)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -67,20 +67,6 @@ namespace Trinity
|
|||||||
void SendToSelf(void);
|
void SendToSelf(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TRINITY_DLL_DECL PlayerVisibilityNotifier
|
|
||||||
{
|
|
||||||
Player &i_player;
|
|
||||||
UpdateData i_data;
|
|
||||||
Player::ClientGUIDs i_clientGUIDs;
|
|
||||||
std::set<WorldObject*> i_visibleNow;
|
|
||||||
|
|
||||||
PlayerVisibilityNotifier(Player &player) : i_player(player),i_clientGUIDs(player.m_clientGUIDs) {}
|
|
||||||
|
|
||||||
template<class T> inline void Visit(GridRefManager<T> &);
|
|
||||||
|
|
||||||
void Notify(void);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct TRINITY_DLL_DECL PlayerRelocationNotifier
|
struct TRINITY_DLL_DECL PlayerRelocationNotifier
|
||||||
{
|
{
|
||||||
Player &i_player;
|
Player &i_player;
|
||||||
|
|||||||
@@ -85,17 +85,6 @@ inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2)
|
|||||||
c2->AI()->MoveInLineOfSight(c1);
|
c2->AI()->MoveInLineOfSight(c1);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
|
||||||
inline void
|
|
||||||
Trinity::PlayerVisibilityNotifier::Visit(GridRefManager<T> &m)
|
|
||||||
{
|
|
||||||
for (typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
|
|
||||||
{
|
|
||||||
i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_visibleNow);
|
|
||||||
i_clientGUIDs.erase(iter->getSource()->GetGUID());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
template<class T, class VISITOR>
|
template<class T, class VISITOR>
|
||||||
inline void
|
inline void
|
||||||
Trinity::DelayedUnitRelocation::Notify(GridRefManager<T> &m)
|
Trinity::DelayedUnitRelocation::Notify(GridRefManager<T> &m)
|
||||||
|
|||||||
+2
-109
@@ -213,14 +213,12 @@ Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode, Map* _par
|
|||||||
: i_mapEntry (sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode), i_InstanceId(InstanceId), m_unloadTimer(0),
|
: i_mapEntry (sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode), i_InstanceId(InstanceId), m_unloadTimer(0),
|
||||||
m_activeNonPlayersIter(m_activeNonPlayers.end()),
|
m_activeNonPlayersIter(m_activeNonPlayers.end()),
|
||||||
i_gridExpiry(expiry), m_parentMap(_parent ? _parent : this),
|
i_gridExpiry(expiry), m_parentMap(_parent ? _parent : this),
|
||||||
m_VisibleDistance(DEFAULT_VISIBILITY_DISTANCE)
|
m_VisibleDistance(DEFAULT_VISIBILITY_DISTANCE),
|
||||||
, i_notifyLock(false), i_scriptLock(false),
|
i_scriptLock(false),
|
||||||
m_PlayerVisibilityNotifyTimer(0.75*DEFAULT_VISIBILITY_NOTIFY_PERIOD, 0.25*DEFAULT_VISIBILITY_NOTIFY_PERIOD),
|
m_PlayerVisibilityNotifyTimer(0.75*DEFAULT_VISIBILITY_NOTIFY_PERIOD, 0.25*DEFAULT_VISIBILITY_NOTIFY_PERIOD),
|
||||||
m_ObjectVisibilityNotifyTimer(DEFAULT_VISIBILITY_NOTIFY_PERIOD, 0 * DEFAULT_VISIBILITY_NOTIFY_PERIOD),
|
m_ObjectVisibilityNotifyTimer(DEFAULT_VISIBILITY_NOTIFY_PERIOD, 0 * DEFAULT_VISIBILITY_NOTIFY_PERIOD),
|
||||||
m_RelocationNotifyTimer(DEFAULT_VISIBILITY_NOTIFY_PERIOD,0.5*DEFAULT_VISIBILITY_NOTIFY_PERIOD)
|
m_RelocationNotifyTimer(DEFAULT_VISIBILITY_NOTIFY_PERIOD,0.5*DEFAULT_VISIBILITY_NOTIFY_PERIOD)
|
||||||
{
|
{
|
||||||
m_notifyTimer.SetInterval(IN_MILISECONDS/2);
|
|
||||||
|
|
||||||
for (unsigned int idx=0; idx < MAX_NUMBER_OF_GRIDS; ++idx)
|
for (unsigned int idx=0; idx < MAX_NUMBER_OF_GRIDS; ++idx)
|
||||||
{
|
{
|
||||||
for (unsigned int j=0; j < MAX_NUMBER_OF_GRIDS; ++j)
|
for (unsigned int j=0; j < MAX_NUMBER_OF_GRIDS; ++j)
|
||||||
@@ -603,111 +601,6 @@ bool Map::loaded(const GridPair &p) const
|
|||||||
return ( getNGrid(p.x_coord, p.y_coord) && isGridObjectDataLoaded(p.x_coord, p.y_coord) );
|
return ( getNGrid(p.x_coord, p.y_coord) && isGridObjectDataLoaded(p.x_coord, p.y_coord) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Map::RelocationNotify()
|
|
||||||
{
|
|
||||||
/* i_notifyLock = true;
|
|
||||||
|
|
||||||
//Notify
|
|
||||||
for (std::vector<Unit*>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
|
|
||||||
{
|
|
||||||
Unit *unit = *iter;
|
|
||||||
if(!unit)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
unit->m_NotifyListPos = -1;
|
|
||||||
|
|
||||||
if(unit->m_Notified)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
unit->m_Notified = true;
|
|
||||||
|
|
||||||
float dist = abs(unit->GetPositionX() - unit->oldX) + abs(unit->GetPositionY() - unit->oldY);
|
|
||||||
if(dist > 10.0f)
|
|
||||||
{
|
|
||||||
Trinity::VisibleChangesNotifier notifier(*unit);
|
|
||||||
VisitWorld(unit->oldX, unit->oldY, GetVisibilityDistance(), notifier);
|
|
||||||
dist = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(unit->GetTypeId() == TYPEID_PLAYER)
|
|
||||||
{
|
|
||||||
Trinity::PlayerRelocationNotifier notifier(*((Player*)unit));
|
|
||||||
//if(((Player*)unit)->m_seer != unit)
|
|
||||||
VisitAll(((Player*)unit)->m_seer->GetPositionX(), ((Player*)unit)->m_seer->GetPositionY(), unit->GetMap()->GetVisibilityDistance() + dist, notifier);
|
|
||||||
//else
|
|
||||||
//VisitAll(((Player*)unit)->GetPositionX(), ((Player*)unit)->GetPositionY(), unit->GetMap()->GetVisibilityDistance() + dist, notifier);
|
|
||||||
notifier.Notify();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Trinity::CreatureRelocationNotifier notifier(*((Creature*)unit));
|
|
||||||
VisitAll(unit->GetPositionX(), unit->GetPositionY(), GetVisibilityDistance() + dist, notifier);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
for (std::vector<Unit*>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
|
|
||||||
if(*iter)
|
|
||||||
(*iter)->m_Notified = false;
|
|
||||||
i_unitsToNotify.clear();
|
|
||||||
|
|
||||||
i_notifyLock = false;
|
|
||||||
|
|
||||||
if(!i_unitsToNotifyBacklog.empty())
|
|
||||||
{
|
|
||||||
i_unitsToNotify.insert(i_unitsToNotify.end(), i_unitsToNotifyBacklog.begin(), i_unitsToNotifyBacklog.end());
|
|
||||||
i_unitsToNotifyBacklog.clear();
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void Map::AddUnitToNotify(Unit* u)
|
|
||||||
{
|
|
||||||
/* if(u->m_NotifyListPos < 0 && u->IsInWorld())
|
|
||||||
{
|
|
||||||
u->oldX = u->GetPositionX();
|
|
||||||
u->oldY = u->GetPositionY();
|
|
||||||
|
|
||||||
if(i_notifyLock)
|
|
||||||
{
|
|
||||||
u->m_NotifyListPos = i_unitsToNotifyBacklog.size();
|
|
||||||
i_unitsToNotifyBacklog.push_back(u);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
u->m_NotifyListPos = i_unitsToNotify.size();
|
|
||||||
i_unitsToNotify.push_back(u);
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
|
|
||||||
void Map::RemoveUnitFromNotify(Unit *unit)
|
|
||||||
{
|
|
||||||
int32 slot = unit->m_NotifyListPos;
|
|
||||||
if(i_notifyLock)
|
|
||||||
{
|
|
||||||
if(slot < i_unitsToNotifyBacklog.size() && i_unitsToNotifyBacklog[slot] == unit)
|
|
||||||
i_unitsToNotifyBacklog[slot] = NULL;
|
|
||||||
else if(slot < i_unitsToNotify.size() && i_unitsToNotify[slot] == unit)
|
|
||||||
i_unitsToNotify[slot] = NULL;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sLog.outError("Map::RemoveUnitFromNotify(Unit*) unit has incorrect notify slot=%d, cleaning up",slot);
|
|
||||||
unit->m_NotifyListPos = -1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(slot >= i_unitsToNotify.size())
|
|
||||||
{
|
|
||||||
sLog.outError("Map::RemoveUnitFromNotify(Unit*) unit has incorrect notify slot=%d, cleaning up", slot);
|
|
||||||
unit->m_NotifyListPos = -1;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
i_unitsToNotify[slot] = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
unit->m_NotifyListPos = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Map::Update(const uint32 &t_diff)
|
void Map::Update(const uint32 &t_diff)
|
||||||
{
|
{
|
||||||
/// update players at tick
|
/// update players at tick
|
||||||
|
|||||||
+1
-8
@@ -364,7 +364,6 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O
|
|||||||
|
|
||||||
void MoveAllCreaturesInMoveList();
|
void MoveAllCreaturesInMoveList();
|
||||||
void RemoveAllObjectsInRemoveList();
|
void RemoveAllObjectsInRemoveList();
|
||||||
void RelocationNotify();
|
|
||||||
virtual void RemoveAllPlayers();
|
virtual void RemoveAllPlayers();
|
||||||
|
|
||||||
bool CreatureRespawnRelocation(Creature *c); // used only in MoveAllCreaturesInMoveList and ObjectGridUnloader
|
bool CreatureRespawnRelocation(Creature *c); // used only in MoveAllCreaturesInMoveList and ObjectGridUnloader
|
||||||
@@ -416,8 +415,6 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O
|
|||||||
uint32 GetPlayersCountExceptGMs() const;
|
uint32 GetPlayersCountExceptGMs() const;
|
||||||
bool ActiveObjectsNearGrid(uint32 x, uint32 y) const;
|
bool ActiveObjectsNearGrid(uint32 x, uint32 y) const;
|
||||||
|
|
||||||
void AddUnitToNotify(Unit* unit);
|
|
||||||
void RemoveUnitFromNotify(Unit *unit);
|
|
||||||
void AddWorldObject(WorldObject *obj) { i_worldObjects.insert(obj); }
|
void AddWorldObject(WorldObject *obj) { i_worldObjects.insert(obj); }
|
||||||
void RemoveWorldObject(WorldObject *obj) { i_worldObjects.erase(obj); }
|
void RemoveWorldObject(WorldObject *obj) { i_worldObjects.erase(obj); }
|
||||||
|
|
||||||
@@ -541,16 +538,12 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O
|
|||||||
GridMap *GridMaps[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
|
GridMap *GridMaps[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS];
|
||||||
std::bitset<TOTAL_NUMBER_OF_CELLS_PER_MAP*TOTAL_NUMBER_OF_CELLS_PER_MAP> marked_cells;
|
std::bitset<TOTAL_NUMBER_OF_CELLS_PER_MAP*TOTAL_NUMBER_OF_CELLS_PER_MAP> marked_cells;
|
||||||
|
|
||||||
IntervalTimer m_notifyTimer;
|
|
||||||
|
|
||||||
void ProcessObjectsVisibility();
|
void ProcessObjectsVisibility();
|
||||||
void ProcesssPlayersVisibility();
|
void ProcesssPlayersVisibility();
|
||||||
void ProcessRelocationNotifies();
|
void ProcessRelocationNotifies();
|
||||||
void ResetNotifies(uint16 notify_mask);
|
void ResetNotifies(uint16 notify_mask);
|
||||||
|
|
||||||
bool i_notifyLock, i_scriptLock;
|
bool i_scriptLock;
|
||||||
std::vector<Unit*> i_unitsToNotifyBacklog;
|
|
||||||
std::vector<Unit*> i_unitsToNotify;
|
|
||||||
std::set<WorldObject *> i_objectsToRemove;
|
std::set<WorldObject *> i_objectsToRemove;
|
||||||
std::map<WorldObject*, bool> i_objectsToSwitch;
|
std::map<WorldObject*, bool> i_objectsToSwitch;
|
||||||
std::set<WorldObject*> i_worldObjects;
|
std::set<WorldObject*> i_worldObjects;
|
||||||
|
|||||||
+1
-7
@@ -93,7 +93,7 @@ static bool procPrepared = InitTriggerAuraData();
|
|||||||
|
|
||||||
Unit::Unit()
|
Unit::Unit()
|
||||||
: WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostilRefManager(this)
|
: WorldObject(), i_motionMaster(this), m_ThreatManager(this), m_HostilRefManager(this)
|
||||||
, m_NotifyListPos(-1), m_Notified(false), IsAIEnabled(false), NeedChangeAI(false)
|
, IsAIEnabled(false), NeedChangeAI(false)
|
||||||
, i_AI(NULL), i_disabledAI(NULL), m_removedAurasCount(0), m_vehicle(NULL), m_transport(NULL)
|
, i_AI(NULL), i_disabledAI(NULL), m_removedAurasCount(0), m_vehicle(NULL), m_transport(NULL)
|
||||||
, m_ControlledByPlayer(false), m_procDeep(0), m_unitTypeMask(UNIT_MASK_NONE), m_vehicleKit(NULL)
|
, m_ControlledByPlayer(false), m_procDeep(0), m_unitTypeMask(UNIT_MASK_NONE), m_vehicleKit(NULL)
|
||||||
, m_movedPlayer(NULL)
|
, m_movedPlayer(NULL)
|
||||||
@@ -12773,9 +12773,6 @@ void Unit::AddToWorld()
|
|||||||
if (!IsInWorld())
|
if (!IsInWorld())
|
||||||
{
|
{
|
||||||
WorldObject::AddToWorld();
|
WorldObject::AddToWorld();
|
||||||
m_Notified = false;
|
|
||||||
assert(m_NotifyListPos < 0); //instance : crash
|
|
||||||
//m_NotifyListPos = -1;
|
|
||||||
SetToNotify();
|
SetToNotify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -12803,9 +12800,6 @@ void Unit::RemoveFromWorld()
|
|||||||
|
|
||||||
RemoveAreaAurasDueToLeaveWorld();
|
RemoveAreaAurasDueToLeaveWorld();
|
||||||
|
|
||||||
if (m_NotifyListPos >= 0)
|
|
||||||
GetMap()->RemoveUnitFromNotify(this);
|
|
||||||
|
|
||||||
if (GetCharmerGUID())
|
if (GetCharmerGUID())
|
||||||
{
|
{
|
||||||
sLog.outCrash("Unit %u has charmer guid when removed from world", GetEntry());
|
sLog.outCrash("Unit %u has charmer guid when removed from world", GetEntry());
|
||||||
|
|||||||
@@ -1901,9 +1901,6 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
|||||||
|
|
||||||
// relocation notification
|
// relocation notification
|
||||||
void SetToNotify();
|
void SetToNotify();
|
||||||
bool m_Notified;
|
|
||||||
int32 m_NotifyListPos;
|
|
||||||
float oldX, oldY;
|
|
||||||
|
|
||||||
void SetReducedThreatPercent(uint32 pct, uint64 guid)
|
void SetReducedThreatPercent(uint32 pct, uint64 guid)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user