Core/Cells: Improve cell copy constructor and argument passing codegen (now fully done through a single register)
This commit is contained in:
1 parent
7d2e4e1993
commit
d5cb122e3a
2 files changed
+8
-31
No files matched your search
@@ -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,24 +81,17 @@ 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); }
|
||||
bool operator != (Cell const& cell) const { return !operator == (cell); }
|
||||
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;
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user