aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/server/game/Grids/Cells/Cell.h24
-rw-r--r--src/server/game/Grids/Cells/CellImpl.h15
2 files changed, 8 insertions, 31 deletions
diff --git a/src/server/game/Grids/Cells/Cell.h b/src/server/game/Grids/Cells/Cell.h
index 2e5bd2c2cb9..8462680f02d 100644
--- a/src/server/game/Grids/Cells/Cell.h
+++ b/src/server/game/Grids/Cells/Cell.h
@@ -18,8 +18,6 @@
#ifndef TRINITY_CELL_H
#define TRINITY_CELL_H
-#include <cmath>
-
#include "TypeContainer.h"
#include "TypeContainerVisitor.h"
@@ -47,10 +45,9 @@ struct CellArea
struct Cell
{
- Cell() { data.All = 0; }
- Cell(Cell const& cell) { data.All = cell.data.All; }
+ Cell() : data() { }
explicit Cell(CellCoord const& p);
- explicit Cell(float x, float y);
+ explicit Cell(float x, float y) : Cell(Trinity::ComputeCellCoord(x, y)) { }
void Compute(uint32 &x, uint32 &y) const
{
@@ -84,23 +81,16 @@ struct Cell
data.Part.grid_y * MAX_NUMBER_OF_CELLS+data.Part.cell_y);
}
- Cell& operator=(Cell const& cell)
- {
- this->data.All = cell.data.All;
- return *this;
- }
-
bool operator == (Cell const& cell) const { return (data.All == cell.data.All); }
union
{
struct
{
- unsigned grid_x : 8;
- unsigned grid_y : 8;
- unsigned cell_x : 8;
- unsigned cell_y : 8;
- unsigned nocreate : 8;
- unsigned reserved : 24;
+ uint8 grid_x;
+ uint8 grid_y;
+ uint8 cell_x;
+ uint8 cell_y;
+ uint8 nocreate;
} Part;
uint64 All;
} data;
diff --git a/src/server/game/Grids/Cells/CellImpl.h b/src/server/game/Grids/Cells/CellImpl.h
index 9777029c67d..66b6b30edc0 100644
--- a/src/server/game/Grids/Cells/CellImpl.h
+++ b/src/server/game/Grids/Cells/CellImpl.h
@@ -24,25 +24,12 @@
#include "Map.h"
#include "Object.h"
-inline Cell::Cell(CellCoord const& p)
+inline Cell::Cell(CellCoord const& p) : data()
{
data.Part.grid_x = p.x_coord / MAX_NUMBER_OF_CELLS;
data.Part.grid_y = p.y_coord / MAX_NUMBER_OF_CELLS;
data.Part.cell_x = p.x_coord % MAX_NUMBER_OF_CELLS;
data.Part.cell_y = p.y_coord % MAX_NUMBER_OF_CELLS;
- data.Part.nocreate = 0;
- data.Part.reserved = 0;
-}
-
-inline Cell::Cell(float x, float y)
-{
- CellCoord p = Trinity::ComputeCellCoord(x, y);
- data.Part.grid_x = p.x_coord / MAX_NUMBER_OF_CELLS;
- data.Part.grid_y = p.y_coord / MAX_NUMBER_OF_CELLS;
- data.Part.cell_x = p.x_coord % MAX_NUMBER_OF_CELLS;
- data.Part.cell_y = p.y_coord % MAX_NUMBER_OF_CELLS;
- data.Part.nocreate = 0;
- data.Part.reserved = 0;
}
inline CellArea Cell::CalculateCellArea(float x, float y, float radius)