[8524] New cell search algorithm implemented. You can now choose different visibility distances on continents, in BG/Arenas and instances.

Please, update your config files and check new options:

Visibility.Distance.Continents    = 90
Visibility.Distance.Instances     = 120
Visibility.Distance.BGArenas      = 180

Thanks everyone involved in patch tests!

Signed-off-by: Ambal <pogrebniak@gala.net>
This commit is contained in:
Ambal 2009-09-21 23:25:18 +03:00
parent 81456dc416
commit cfea99ea62
28 changed files with 434 additions and 123 deletions

View file

@ -79,8 +79,19 @@ class MANGOS_DLL_DECL NGrid
i_GridInfo = GridInfo(expiry, unload);
}
const GridType& operator()(unsigned short x, unsigned short y) const { return i_cells[x][y]; }
GridType& operator()(unsigned short x, unsigned short y) { return i_cells[x][y]; }
const GridType& operator()(unsigned short x, unsigned short y) const
{
ASSERT(x < N);
ASSERT(y < N);
return i_cells[x][y];
}
GridType& operator()(unsigned short x, unsigned short y)
{
ASSERT(x < N);
ASSERT(y < N);
return i_cells[x][y];
}
const uint32& GetGridId(void) const { return i_gridId; }
void SetGridId(const uint32 id) const { i_gridId = id; }
@ -108,12 +119,12 @@ class MANGOS_DLL_DECL NGrid
template<class SPECIFIC_OBJECT> void AddWorldObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
{
i_cells[x][y].AddWorldObject(obj, hdl);
getGridType(x, y).AddWorldObject(obj, hdl);
}
template<class SPECIFIC_OBJECT> void RemoveWorldObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
{
i_cells[x][y].RemoveWorldObject(obj, hdl);
getGridType(x, y).RemoveWorldObject(obj, hdl);
}
template<class T, class TT> void Visit(TypeContainerVisitor<T, TypeMapContainer<TT> > &visitor)
@ -125,7 +136,7 @@ class MANGOS_DLL_DECL NGrid
template<class T, class TT> void Visit(const uint32 &x, const uint32 &y, TypeContainerVisitor<T, TypeMapContainer<TT> > &visitor)
{
i_cells[x][y].Visit(visitor);
getGridType(x, y).Visit(visitor);
}
unsigned int ActiveObjectsInGrid(void) const
@ -139,26 +150,33 @@ class MANGOS_DLL_DECL NGrid
template<class SPECIFIC_OBJECT> const SPECIFIC_OBJECT* GetGridObject(const uint32 x, const uint32 y, OBJECT_HANDLE hdl) const
{
return i_cells[x][y].template GetGridObject<SPECIFIC_OBJECT>(hdl);
return getGridType(x, y).template GetGridObject<SPECIFIC_OBJECT>(hdl);
}
template<class SPECIFIC_OBJECT> SPECIFIC_OBJECT* GetGridObject(const uint32 x, const uint32 y, OBJECT_HANDLE hdl)
{
return i_cells[x][y].template GetGridObject<SPECIFIC_OBJECT>(hdl);
return getGridType(x, y).template GetGridObject<SPECIFIC_OBJECT>(hdl);
}
template<class SPECIFIC_OBJECT> bool AddGridObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
{
return i_cells[x][y].AddGridObject(hdl, obj);
return getGridType(x, y).AddGridObject(hdl, obj);
}
template<class SPECIFIC_OBJECT> bool RemoveGridObject(const uint32 x, const uint32 y, SPECIFIC_OBJECT *obj, OBJECT_HANDLE hdl)
{
return i_cells[x][y].RemoveGridObject(obj, hdl);
return getGridType(x, y).RemoveGridObject(obj, hdl);
}
private:
GridType& getGridType(const uint32& x, const uint32& y)
{
ASSERT(x < N);
ASSERT(y < N);
return i_cells[x][y];
}
uint32 i_gridId;
GridInfo i_GridInfo;
GridReference<NGrid<N, ACTIVE_OBJECT, WORLD_OBJECT_TYPES, GRID_OBJECT_TYPES, ThreadModel> > i_Reference;