aboutsummaryrefslogtreecommitdiff
path: root/src/game/Cell.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Cell.h')
-rw-r--r--src/game/Cell.h34
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>