*Fix some visibility bug.
--HG-- branch : trunk
This commit is contained in:
@@ -353,7 +353,8 @@ struct TRINITY_DLL_DECL boss_priestess_guestAI : public ScriptedAI
|
|||||||
boss_priestess_guestAI(Creature* c) : ScriptedAI(c)
|
boss_priestess_guestAI(Creature* c) : ScriptedAI(c)
|
||||||
{
|
{
|
||||||
Group.clear();
|
Group.clear();
|
||||||
pInstance = ((ScriptedInstance*)c->GetInstanceData()); AcquireGUIDs();
|
pInstance = ((ScriptedInstance*)c->GetInstanceData());
|
||||||
|
AcquireGUIDs();
|
||||||
}
|
}
|
||||||
|
|
||||||
ScriptedInstance* pInstance;
|
ScriptedInstance* pInstance;
|
||||||
|
|||||||
+35
-31
@@ -211,7 +211,7 @@ Map::Map(uint32 id, time_t expiry, uint32 InstanceId, uint8 SpawnMode)
|
|||||||
: i_mapEntry (sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode),
|
: i_mapEntry (sMapStore.LookupEntry(id)), i_spawnMode(SpawnMode),
|
||||||
i_id(id), i_InstanceId(InstanceId), m_unloadTimer(0), i_gridExpiry(expiry),
|
i_id(id), i_InstanceId(InstanceId), m_unloadTimer(0), i_gridExpiry(expiry),
|
||||||
m_activeNonPlayersIter(m_activeNonPlayers.end())
|
m_activeNonPlayersIter(m_activeNonPlayers.end())
|
||||||
, i_lock(false)
|
, i_lock(true)
|
||||||
{
|
{
|
||||||
for(unsigned int idx=0; idx < MAX_NUMBER_OF_GRIDS; ++idx)
|
for(unsigned int idx=0; idx < MAX_NUMBER_OF_GRIDS; ++idx)
|
||||||
{
|
{
|
||||||
@@ -507,8 +507,7 @@ Map::Add(T *obj)
|
|||||||
|
|
||||||
DEBUG_LOG("Object %u enters grid[%u,%u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY());
|
DEBUG_LOG("Object %u enters grid[%u,%u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY());
|
||||||
|
|
||||||
if(obj->GetTypeId() != TYPEID_UNIT)
|
UpdateObjectVisibility(obj,cell,p);
|
||||||
UpdateObjectVisibility(obj,cell,p);
|
|
||||||
|
|
||||||
AddNotifier(obj);
|
AddNotifier(obj);
|
||||||
}
|
}
|
||||||
@@ -610,19 +609,25 @@ bool Map::loaded(const GridPair &p) const
|
|||||||
|
|
||||||
void Map::RelocationNotify()
|
void Map::RelocationNotify()
|
||||||
{
|
{
|
||||||
//creatures may be added to the list during update
|
//Move backlog to notify list
|
||||||
i_lock = true;
|
for(std::vector<uint64>::iterator iter = i_unitsToNotifyBacklog.begin(); iter != i_unitsToNotifyBacklog.end(); ++iter)
|
||||||
|
{
|
||||||
|
if(Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL))
|
||||||
|
{
|
||||||
|
i_unitsToNotify.push_back(unit);
|
||||||
|
unit->m_Notified = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i_unitsToNotifyBacklog.clear();
|
||||||
|
|
||||||
//Notify
|
//Notify
|
||||||
for(std::vector<uint64>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
|
for(std::vector<Unit*>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
|
||||||
{
|
{
|
||||||
Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL);
|
Unit *unit = *iter;
|
||||||
if(!unit || !unit->IsInWorld() || unit->GetMapId() != GetId())
|
if(!unit->IsInWorld() || unit->GetMapId() != GetId())
|
||||||
{
|
|
||||||
*iter = 0;
|
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
|
|
||||||
|
unit->m_IsInNotifyList = false;
|
||||||
unit->m_Notified = true;
|
unit->m_Notified = true;
|
||||||
|
|
||||||
if(unit->GetTypeId() == TYPEID_PLAYER)
|
if(unit->GetTypeId() == TYPEID_PLAYER)
|
||||||
@@ -637,23 +642,29 @@ void Map::RelocationNotify()
|
|||||||
VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), notifier);
|
VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), notifier);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Clear list
|
|
||||||
for(std::vector<uint64>::iterator iter = i_unitsToNotify.begin(); iter != i_unitsToNotify.end(); ++iter)
|
|
||||||
{
|
|
||||||
if(Unit *unit = ObjectAccessor::GetObjectInWorld(*iter, (Unit*)NULL))
|
|
||||||
{
|
|
||||||
unit->m_IsInNotifyList = false;
|
|
||||||
unit->m_Notified = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
i_unitsToNotify.clear();
|
i_unitsToNotify.clear();
|
||||||
|
}
|
||||||
|
|
||||||
i_lock = false;
|
void Map::AddUnitToNotify(Unit* u)
|
||||||
|
{
|
||||||
|
if(u->m_IsInNotifyList)
|
||||||
|
return;
|
||||||
|
|
||||||
|
u->m_IsInNotifyList = true;
|
||||||
|
|
||||||
|
if(i_lock)
|
||||||
|
i_unitsToNotifyBacklog.push_back(u->GetGUID());
|
||||||
|
else
|
||||||
|
{
|
||||||
|
i_unitsToNotify.push_back(u);
|
||||||
|
u->m_Notified = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Map::Update(const uint32 &t_diff)
|
void Map::Update(const uint32 &t_diff)
|
||||||
{
|
{
|
||||||
|
i_lock = false;
|
||||||
|
|
||||||
resetMarkedCells();
|
resetMarkedCells();
|
||||||
|
|
||||||
Trinity::ObjectUpdater updater(t_diff);
|
Trinity::ObjectUpdater updater(t_diff);
|
||||||
@@ -782,6 +793,8 @@ void Map::Update(const uint32 &t_diff)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
i_lock = true;
|
||||||
|
|
||||||
RelocationNotify();
|
RelocationNotify();
|
||||||
|
|
||||||
// Don't unload grids if it's battleground, since we may have manually added GOs,creatures, those doesn't load from DB at grid re-load !
|
// Don't unload grids if it's battleground, since we may have manually added GOs,creatures, those doesn't load from DB at grid re-load !
|
||||||
@@ -2186,12 +2199,3 @@ void BattleGroundMap::UnloadAll()
|
|||||||
|
|
||||||
/*--------------------------TRINITY-------------------------*/
|
/*--------------------------TRINITY-------------------------*/
|
||||||
|
|
||||||
void Map::AddUnitToNotify(Unit* u)
|
|
||||||
{
|
|
||||||
if(!i_lock && !u->m_IsInNotifyList)
|
|
||||||
{
|
|
||||||
i_unitsToNotify.push_back(u->GetGUID());
|
|
||||||
u->m_IsInNotifyList = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -339,7 +339,8 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O
|
|||||||
time_t i_gridExpiry;
|
time_t i_gridExpiry;
|
||||||
|
|
||||||
bool i_lock;
|
bool i_lock;
|
||||||
std::vector<uint64> i_unitsToNotify;
|
std::vector<uint64> 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;
|
||||||
|
|
||||||
|
|||||||
@@ -17828,6 +17828,8 @@ void Player::UpdateVisibilityOf(T* target, UpdateData& data, std::set<WorldObjec
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
SetToNotify();
|
||||||
}
|
}
|
||||||
|
|
||||||
/*template<>
|
/*template<>
|
||||||
|
|||||||
@@ -12810,6 +12810,9 @@ void Unit::RemoveAurasAtChanneledTarget(SpellEntry const* spellInfo, Unit * cast
|
|||||||
|
|
||||||
void Unit::SetToNotify()
|
void Unit::SetToNotify()
|
||||||
{
|
{
|
||||||
|
if(m_IsInNotifyList)
|
||||||
|
return;
|
||||||
|
|
||||||
if(Map *map = GetMap())
|
if(Map *map = GetMap())
|
||||||
map->AddUnitToNotify(this);
|
map->AddUnitToNotify(this);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user