diff options
| author | Jan Van Buggenhout <chipzz@chipzz.be> | 2021-04-11 12:50:13 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2022-03-08 00:14:25 +0100 |
| commit | b4f27875f36994d85d174f7eaf3edb108e2ab103 (patch) | |
| tree | 5d0b79af607d0e0b53c1e78684cb1559efc892f1 /src/server/game/Entities/Object | |
| parent | 09ec7d5600506cb84f45e67f7a8a27a9cb87d242 (diff) | |
Core/Entities: Move GridObject to its own header (#26358)
* GridObject
* Add include to more files
(cherry picked from commit 43dd1b37d64dbe22a528d72e399f79ff645342b3)
Diffstat (limited to 'src/server/game/Entities/Object')
| -rw-r--r-- | src/server/game/Entities/Object/GridObject.h | 37 | ||||
| -rw-r--r-- | src/server/game/Entities/Object/Object.h | 16 |
2 files changed, 38 insertions, 15 deletions
diff --git a/src/server/game/Entities/Object/GridObject.h b/src/server/game/Entities/Object/GridObject.h new file mode 100644 index 00000000000..cde2172623a --- /dev/null +++ b/src/server/game/Entities/Object/GridObject.h @@ -0,0 +1,37 @@ +/* + * 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 _GRIDOBJECT_H +#define _GRIDOBJECT_H + +#include "GridReference.h" +#include "GridRefManager.h" + +template<class T> +class GridObject +{ + public: + virtual ~GridObject() { } + + bool IsInGrid() const { return _gridRef.isValid(); } + void AddToGrid(GridRefManager<T>& m) { ASSERT(!IsInGrid()); _gridRef.link(&m, (T*)this); } + void RemoveFromGrid() { ASSERT(IsInGrid()); _gridRef.unlink(); } + private: + GridReference<T> _gridRef; +}; + +#endif diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 7bdd6b1d867..242f9151bd7 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -20,9 +20,8 @@ #include "Common.h" #include "Duration.h" +#include "Errors.h" #include "EventProcessor.h" -#include "GridReference.h" -#include "GridRefManager.h" #include "ModelIgnoreFlags.h" #include "MovementInfo.h" #include "ObjectDefines.h" @@ -403,19 +402,6 @@ class TC_GAME_API Object Object& operator=(Object&& right) = delete; }; -template<class T> -class GridObject -{ - public: - virtual ~GridObject() { } - - bool IsInGrid() const { return _gridRef.isValid(); } - void AddToGrid(GridRefManager<T>& m) { ASSERT(!IsInGrid()); _gridRef.link(&m, (T*)this); } - void RemoveFromGrid() { ASSERT(IsInGrid()); _gridRef.unlink(); } - private: - GridReference<T> _gridRef; -}; - template <class T_VALUES, class T_FLAGS, class FLAG_TYPE, size_t ARRAY_SIZE> class FlaggedValuesArray32 { |
