*Fix a crash caused by far sight spells.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-02-26 10:42:37 -06:00
parent 1af157d012
commit 4b19153a79
3 changed files with 12 additions and 13 deletions
+7 -7
View File
@@ -105,7 +105,7 @@ class TRINITY_DLL_DECL Grid
/** Returns the number of object within the grid.
*/
unsigned int ActiveObjectsInGrid(void) const { return m_activeGridObjects.size()+i_objects.template Count<ACTIVE_OBJECT>(); }
unsigned int ActiveObjectsInGrid(void) const { return /*m_activeGridObjects.size()+*/i_objects.template Count<ACTIVE_OBJECT>(); }
/** Accessors: Returns a specific type of object in the GRID_OBJECT_TYPES
*/
@@ -116,8 +116,8 @@ class TRINITY_DLL_DECL Grid
*/
template<class SPECIFIC_OBJECT> bool AddGridObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
{
if(obj->isActiveObject())
m_activeGridObjects.insert(obj);
//if(obj->isActiveObject())
// m_activeGridObjects.insert(obj);
return i_container.template insert<SPECIFIC_OBJECT>(hdl, obj);
}
@@ -125,8 +125,8 @@ class TRINITY_DLL_DECL Grid
*/
template<class SPECIFIC_OBJECT> bool RemoveGridObject(SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
{
if(obj->isActiveObject())
m_activeGridObjects.erase(obj);
//if(obj->isActiveObject())
// m_activeGridObjects.erase(obj);
return i_container.template remove<SPECIFIC_OBJECT>(obj, hdl);
}
@@ -146,8 +146,8 @@ class TRINITY_DLL_DECL Grid
TypeMapContainer<GRID_OBJECT_TYPES> i_container;
TypeMapContainer<WORLD_OBJECT_TYPES> i_objects;
typedef std::set<void*> ActiveGridObjects;
ActiveGridObjects m_activeGridObjects;
//typedef std::set<void*> ActiveGridObjects;
//ActiveGridObjects m_activeGridObjects;
};
#endif
+1 -2
View File
@@ -844,10 +844,9 @@ Map::Remove(T *obj, bool remove)
NGridType *grid = getNGrid(cell.GridX(), cell.GridY());
assert( grid != NULL );
obj->RemoveFromWorld();
if(obj->isActiveObject())
RemoveFromActive(obj);
obj->RemoveFromWorld();
RemoveFromGrid(obj,grid,cell);
UpdateObjectVisibility(obj,cell,p);
+4 -4
View File
@@ -1082,9 +1082,9 @@ void WorldObject::setActive( bool on )
{
map = GetMap();
if(GetTypeId() == TYPEID_UNIT)
map->Remove((Creature*)this,false);
map->RemoveFromActive((Creature*)this);
else if(GetTypeId() == TYPEID_DYNAMICOBJECT)
map->Remove((DynamicObject*)this,false);
map->RemoveFromActive((DynamicObject*)this);
}
m_isActive = on;
@@ -1092,9 +1092,9 @@ void WorldObject::setActive( bool on )
if(world)
{
if(GetTypeId() == TYPEID_UNIT)
map->Add((Creature*)this);
map->AddToActive((Creature*)this);
else if(GetTypeId() == TYPEID_DYNAMICOBJECT)
map->Add((DynamicObject*)this);
map->AddToActive((DynamicObject*)this);
}
}