diff options
author | Shauren <shauren.trinity@gmail.com> | 2020-09-04 13:38:24 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2020-09-04 13:38:24 +0200 |
commit | b23190393248455f04d3a06def030a1ec7efad1e (patch) | |
tree | 1ce3772314492dcdb985641269a3114813d4b4dc /src/common/Collision/RegularGrid.h | |
parent | b20acfe701e6f5f995f2776f076d3c494c02e1aa (diff) |
Core/Misc: Port all the refactors sneaked in master to 3.3.5 include cleanup port
Diffstat (limited to 'src/common/Collision/RegularGrid.h')
-rw-r--r-- | src/common/Collision/RegularGrid.h | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/src/common/Collision/RegularGrid.h b/src/common/Collision/RegularGrid.h index 5de9d80c893..953ddd44a35 100644 --- a/src/common/Collision/RegularGrid.h +++ b/src/common/Collision/RegularGrid.h @@ -1,3 +1,20 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + #ifndef _REGULAR_GRID_H #define _REGULAR_GRID_H @@ -86,15 +103,18 @@ public: struct Cell { int x, y; - bool operator == (const Cell& c2) const { return x == c2.x && y == c2.y;} + bool operator==(Cell const& c2) const + { + return x == c2.x && y == c2.y; + } static Cell ComputeCell(float fx, float fy) { - Cell c = { int(fx * (1.f/CELL_SIZE) + (CELL_NUMBER/2)), int(fy * (1.f/CELL_SIZE) + (CELL_NUMBER/2)) }; + Cell c = { int(fx * (1.f / CELL_SIZE) + (CELL_NUMBER / 2)), int(fy * (1.f / CELL_SIZE) + (CELL_NUMBER / 2)) }; return c; } - bool isValid() const { return x >= 0 && x < CELL_NUMBER && y >= 0 && y < CELL_NUMBER;} + bool isValid() const { return x >= 0 && x < CELL_NUMBER && y >= 0 && y < CELL_NUMBER; } }; Node& getGrid(int x, int y) |