*Fix a crash.
--HG-- branch : trunk
This commit is contained in:
+8
-4
@@ -339,19 +339,23 @@ void Map::SwitchGridContainers(T* obj, bool on)
|
||||
|
||||
if(on)
|
||||
{
|
||||
if(!grid.RemoveGridObject<T>(obj, obj->GetGUID())
|
||||
grid.RemoveGridObject<T>(obj, obj->GetGUID());
|
||||
grid.AddWorldObject<T>(obj, obj->GetGUID());
|
||||
/*if(!grid.RemoveGridObject<T>(obj, obj->GetGUID())
|
||||
|| !grid.AddWorldObject<T>(obj, obj->GetGUID()))
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!grid.RemoveWorldObject<T>(obj, obj->GetGUID())
|
||||
grid.RemoveWorldObject<T>(obj, obj->GetGUID());
|
||||
grid.AddGridObject<T>(obj, obj->GetGUID());
|
||||
/*if(!grid.RemoveWorldObject<T>(obj, obj->GetGUID())
|
||||
|| !grid.AddGridObject<T>(obj, obj->GetGUID()))
|
||||
{
|
||||
assert(false);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
obj->IsTempWorldObject = on;
|
||||
}
|
||||
|
||||
@@ -372,6 +372,8 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O
|
||||
if(m_activeNonPlayersIter != m_activeNonPlayers.end())
|
||||
{
|
||||
ActiveNonPlayers::iterator itr = m_activeNonPlayers.find(obj);
|
||||
if(itr == m_activeNonPlayers.end())
|
||||
return;
|
||||
if(itr==m_activeNonPlayersIter)
|
||||
++m_activeNonPlayersIter;
|
||||
m_activeNonPlayers.erase(itr);
|
||||
|
||||
+6
-2
@@ -8526,19 +8526,23 @@ void Unit::SetCharm(Unit* pet)
|
||||
|
||||
void Unit::AddPlayerToVision(Player* plr)
|
||||
{
|
||||
setActive(true);
|
||||
if(m_sharedVision.empty())
|
||||
{
|
||||
setActive(true);
|
||||
SetWorldObject(true);
|
||||
}
|
||||
m_sharedVision.push_back(plr);
|
||||
plr->SetFarsightTarget(this);
|
||||
}
|
||||
|
||||
void Unit::RemovePlayerFromVision(Player* plr)
|
||||
{
|
||||
setActive(false);
|
||||
m_sharedVision.remove(plr);
|
||||
if(m_sharedVision.empty())
|
||||
{
|
||||
setActive(false);
|
||||
SetWorldObject(false);
|
||||
}
|
||||
plr->ClearFarsight();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user