Core/Entities: Move GridObject to its own header (#26358)

* GridObject

* Add include to more files

(cherry picked from commit 43dd1b37d6)
This commit is contained in:
Jan Van Buggenhout
2021-04-11 12:50:13 +02:00
committed by Shauren
parent 09ec7d5600
commit b4f27875f3
10 changed files with 46 additions and 15 deletions

View File

@@ -19,6 +19,7 @@
#define TRINITYCORE_AREATRIGGER_H
#include "Object.h"
#include "GridObject.h"
#include "MapObject.h"
#include "AreaTriggerTemplate.h"

View File

@@ -19,6 +19,7 @@
#define TRINITYCORE_CONVERSATION_H
#include "Object.h"
#include "GridObject.h"
#include "Hash.h"
class Unit;

View File

@@ -19,6 +19,7 @@
#define TRINITYCORE_CORPSE_H
#include "Object.h"
#include "GridObject.h"
#include "DatabaseEnvFwd.h"
#include "GridDefines.h"
#include "IteratorPair.h"

View File

@@ -24,6 +24,7 @@
#include "DatabaseEnvFwd.h"
#include "Duration.h"
#include "Loot.h"
#include "GridObject.h"
#include "MapObject.h"
#include <list>

View File

@@ -19,6 +19,7 @@
#define TRINITYCORE_DYNAMICOBJECT_H
#include "Object.h"
#include "GridObject.h"
#include "MapObject.h"
class Unit;

View File

@@ -19,6 +19,7 @@
#define TRINITYCORE_GAMEOBJECT_H
#include "Object.h"
#include "GridObject.h"
#include "GameObjectData.h"
#include "Loot.h"
#include "MapObject.h"

View File

@@ -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

View File

@@ -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
{

View File

@@ -18,6 +18,7 @@
#ifndef _PLAYER_H
#define _PLAYER_H
#include "GridObject.h"
#include "Unit.h"
#include "CUFProfile.h"
#include "DatabaseEnvFwd.h"

View File

@@ -19,6 +19,7 @@
#define SceneObject_h__
#include "Object.h"
#include "GridObject.h"
struct SceneTemplate;