diff options
author | maximius <none@none> | 2009-09-27 02:24:25 -0700 |
---|---|---|
committer | maximius <none@none> | 2009-09-27 02:24:25 -0700 |
commit | f980dd9ac6c1679caac7a41d806d65c90a02939f (patch) | |
tree | add2748b3fcfd38d00883789dc692c087deed77f /src/game/Cell.h | |
parent | a635bdd0ccdf77c56c45ee1a6d456b3a2ef43ff3 (diff) |
*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
Diffstat (limited to 'src/game/Cell.h')
-rw-r--r-- | src/game/Cell.h | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/src/game/Cell.h b/src/game/Cell.h index 6ccd3c96a00..9baf4104080 100644 --- a/src/game/Cell.h +++ b/src/game/Cell.h @@ -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> |