*Fix a crash.
--HG-- branch : trunk
This commit is contained in:
@@ -60,16 +60,18 @@ class TRINITY_DLL_DECL Grid
|
|||||||
|
|
||||||
/** an object of interested enters the grid
|
/** an object of interested enters the grid
|
||||||
*/
|
*/
|
||||||
template<class SPECIFIC_OBJECT> bool AddWorldObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
|
template<class SPECIFIC_OBJECT> void AddWorldObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
|
||||||
{
|
{
|
||||||
return i_objects.template insert<SPECIFIC_OBJECT>(hdl, obj);
|
if(!i_objects.template insert<SPECIFIC_OBJECT>(hdl, obj))
|
||||||
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** an object of interested exits the grid
|
/** an object of interested exits the grid
|
||||||
*/
|
*/
|
||||||
template<class SPECIFIC_OBJECT> bool RemoveWorldObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
|
template<class SPECIFIC_OBJECT> void RemoveWorldObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
|
||||||
{
|
{
|
||||||
return i_objects.template remove<SPECIFIC_OBJECT>(obj, hdl);
|
if(!i_objects.template remove<SPECIFIC_OBJECT>(obj, hdl))
|
||||||
|
assert(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Accessors: Returns a specific type of object in the WORDL_OBJECT_TYPES
|
/** Accessors: Returns a specific type of object in the WORDL_OBJECT_TYPES
|
||||||
@@ -114,20 +116,18 @@ class TRINITY_DLL_DECL Grid
|
|||||||
|
|
||||||
/** Inserts a container type object into the grid.
|
/** Inserts a container type object into the grid.
|
||||||
*/
|
*/
|
||||||
template<class SPECIFIC_OBJECT> bool AddGridObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
|
template<class SPECIFIC_OBJECT> void AddGridObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
|
||||||
{
|
{
|
||||||
//if(obj->isActiveObject())
|
if(!i_container.template insert<SPECIFIC_OBJECT>(hdl, obj))
|
||||||
// m_activeGridObjects.insert(obj);
|
assert(false);
|
||||||
return i_container.template insert<SPECIFIC_OBJECT>(hdl, obj);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Removes a containter type object from the grid
|
/** Removes a containter type object from the grid
|
||||||
*/
|
*/
|
||||||
template<class SPECIFIC_OBJECT> bool RemoveGridObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
|
template<class SPECIFIC_OBJECT> void RemoveGridObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
|
||||||
{
|
{
|
||||||
//if(obj->isActiveObject())
|
if(!i_container.template remove<SPECIFIC_OBJECT>(obj, hdl))
|
||||||
// m_activeGridObjects.erase(obj);
|
assert(false);
|
||||||
return i_container.template remove<SPECIFIC_OBJECT>(obj, hdl);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*bool NoWorldObjectInGrid() const
|
/*bool NoWorldObjectInGrid() const
|
||||||
|
|||||||
+8
-4
@@ -339,19 +339,23 @@ void Map::SwitchGridContainers(T* obj, bool on)
|
|||||||
|
|
||||||
if(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()))
|
|| !grid.AddWorldObject<T>(obj, obj->GetGUID()))
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
else
|
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()))
|
|| !grid.AddGridObject<T>(obj, obj->GetGUID()))
|
||||||
{
|
{
|
||||||
assert(false);
|
assert(false);
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
obj->IsTempWorldObject = on;
|
obj->IsTempWorldObject = on;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -372,6 +372,8 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O
|
|||||||
if(m_activeNonPlayersIter != m_activeNonPlayers.end())
|
if(m_activeNonPlayersIter != m_activeNonPlayers.end())
|
||||||
{
|
{
|
||||||
ActiveNonPlayers::iterator itr = m_activeNonPlayers.find(obj);
|
ActiveNonPlayers::iterator itr = m_activeNonPlayers.find(obj);
|
||||||
|
if(itr == m_activeNonPlayers.end())
|
||||||
|
return;
|
||||||
if(itr==m_activeNonPlayersIter)
|
if(itr==m_activeNonPlayersIter)
|
||||||
++m_activeNonPlayersIter;
|
++m_activeNonPlayersIter;
|
||||||
m_activeNonPlayers.erase(itr);
|
m_activeNonPlayers.erase(itr);
|
||||||
|
|||||||
+6
-2
@@ -8526,19 +8526,23 @@ void Unit::SetCharm(Unit* pet)
|
|||||||
|
|
||||||
void Unit::AddPlayerToVision(Player* plr)
|
void Unit::AddPlayerToVision(Player* plr)
|
||||||
{
|
{
|
||||||
setActive(true);
|
|
||||||
if(m_sharedVision.empty())
|
if(m_sharedVision.empty())
|
||||||
|
{
|
||||||
|
setActive(true);
|
||||||
SetWorldObject(true);
|
SetWorldObject(true);
|
||||||
|
}
|
||||||
m_sharedVision.push_back(plr);
|
m_sharedVision.push_back(plr);
|
||||||
plr->SetFarsightTarget(this);
|
plr->SetFarsightTarget(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Unit::RemovePlayerFromVision(Player* plr)
|
void Unit::RemovePlayerFromVision(Player* plr)
|
||||||
{
|
{
|
||||||
setActive(false);
|
|
||||||
m_sharedVision.remove(plr);
|
m_sharedVision.remove(plr);
|
||||||
if(m_sharedVision.empty())
|
if(m_sharedVision.empty())
|
||||||
|
{
|
||||||
|
setActive(false);
|
||||||
SetWorldObject(false);
|
SetWorldObject(false);
|
||||||
|
}
|
||||||
plr->ClearFarsight();
|
plr->ClearFarsight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user