*Merge [8524] New cell search algorithm implemented. You can now choose different

visibility distances on continents, in BG/Arenas and instances. Author: Ambal
*Some warning cleanup

--HG--
branch : trunk
This commit is contained in:
maximius
2009-09-27 02:24:25 -07:00
parent a635bdd0cc
commit f980dd9ac6
30 changed files with 606 additions and 140 deletions
+31 -3
View File
@@ -29,6 +29,7 @@
#include "GridDefines.h"
class Map;
class WorldObject;
enum District
{
@@ -46,6 +47,27 @@ enum District
template<class T> struct CellLock;
struct TRINITY_DLL_DECL CellArea
{
CellArea() : right_offset(0), left_offset(0), upper_offset(0), lower_offset(0) {}
CellArea(int right, int left, int upper, int lower) : right_offset(right), left_offset(left), upper_offset(upper), lower_offset(lower) {}
bool operator!() const { return !right_offset && !left_offset && !upper_offset && !lower_offset; }
void ResizeBorders(CellPair& begin_cell, CellPair& end_cell) const
{
begin_cell << left_offset;
begin_cell -= lower_offset;
end_cell >> right_offset;
end_cell += upper_offset;
}
int right_offset;
int left_offset;
int upper_offset;
int lower_offset;
};
struct TRINITY_DLL_DECL Cell
{
Cell() { data.All = 0; }
@@ -135,16 +157,22 @@ struct TRINITY_DLL_DECL Cell
{
unsigned grid_x : 6;
unsigned grid_y : 6;
unsigned cell_x : 4;
unsigned cell_y : 4;
unsigned cell_x : 6;
unsigned cell_y : 6;
unsigned nocreate : 1;
unsigned reserved : 11;
unsigned reserved : 7;
} Part;
uint32 All;
} data;
template<class LOCK_TYPE, class T, class CONTAINER> void Visit(const CellLock<LOCK_TYPE> &, TypeContainerVisitor<T, CONTAINER> &visitor, Map &) const;
template<class LOCK_TYPE, class T, class CONTAINER> void Visit(const CellLock<LOCK_TYPE> &, TypeContainerVisitor<T, CONTAINER> &visitor, Map &m, const WorldObject &obj, float radius) const;
template<class LOCK_TYPE, class T, class CONTAINER> void Visit(const CellLock<LOCK_TYPE> &, TypeContainerVisitor<T, CONTAINER> &visitor, Map &, float radius, float x_off, float y_off) const;
static CellArea CalculateCellArea(const WorldObject &obj, float radius);
private:
template<class LOCK_TYPE, class T, class CONTAINER> void VisitCircle(const CellLock<LOCK_TYPE> &, TypeContainerVisitor<T, CONTAINER> &, Map &, const CellPair& , const CellPair& ) const;
};
template<class T>