Core/Cells: Improve cell copy constructor and argument passing codegen (now fully done through a single register)
(cherry picked from commit 8a619460e21a9603a45894db88e344a0499c2d0f)
This commit is contained in:
@@ -45,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
|
||||
{
|
||||
@@ -82,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;
|
||||
|
||||
@@ -22,25 +22,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)
|
||||
|
||||
Reference in New Issue
Block a user