*First step of dynamic cell visit. Hope nothing is broken.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-11 11:37:58 -06:00
parent 39083f4ff8
commit 415cccfed9
4 changed files with 65 additions and 3 deletions
+12
View File
@@ -150,6 +150,18 @@ namespace Trinity
return Compute<CellPair, CENTER_GRID_CELL_ID>(x, y, CENTER_GRID_CELL_OFFSET, SIZE_OF_GRID_CELL);
}
inline CellPair ComputeCellPair(float x, float y, float &x_off, float &y_off)
{
double x_offset = (double(x) - CENTER_GRID_CELL_OFFSET)/SIZE_OF_GRID_CELL;
double y_offset = (double(y) - CENTER_GRID_CELL_OFFSET)/SIZE_OF_GRID_CELL;
int x_val = int(x_offset + 0.5);
int y_val = int(y_offset + 0.5);
x_off = (float(x_offset) - x_val) * SIZE_OF_GRID_CELL;
y_off = (float(y_offset) - y_val) * SIZE_OF_GRID_CELL;
return CellPair(x_val + CENTER_GRID_CELL_ID, y_val + CENTER_GRID_CELL_ID);
}
inline void NormalizeMapCoord(float &c)
{
if(c > MAP_HALFSIZE - 0.5)