TrinityCore
MapObject.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef MapObject_h__
19#define MapObject_h__
20
21#include "Define.h"
22#include "Cell.h"
23#include "Position.h"
24
25class Map;
27
29{
30 MAP_OBJECT_CELL_MOVE_NONE, //not in move list
32 MAP_OBJECT_CELL_MOVE_INACTIVE, //in move list but should not move
33};
34
36{
37 friend class Map; //map for moving creatures
38 friend class ObjectGridLoaderBase; //grid loader for loading creatures
39
40protected:
42 {
43 _newPosition.Relocate(0.0f, 0.0f, 0.0f, 0.0f);
44 }
45
46private:
48 Cell const& GetCurrentCell() const { return _currentCell; }
49 void SetCurrentCell(Cell const& cell) { _currentCell = cell; }
50
53 void SetNewCellPosition(float x, float y, float z, float o)
54 {
55 _moveState = MAP_OBJECT_CELL_MOVE_ACTIVE;
56 _newPosition.Relocate(x, y, z, o);
57 }
58};
59
60#endif // MapObject_h__
#define TC_GAME_API
Definition: Define.h:123
MapObjectCellMoveState
Definition: MapObject.h:29
@ MAP_OBJECT_CELL_MOVE_INACTIVE
Definition: MapObject.h:32
@ MAP_OBJECT_CELL_MOVE_ACTIVE
Definition: MapObject.h:31
@ MAP_OBJECT_CELL_MOVE_NONE
Definition: MapObject.h:30
Cell _currentCell
Definition: MapObject.h:47
void SetCurrentCell(Cell const &cell)
Definition: MapObject.h:49
MapObjectCellMoveState _moveState
Definition: MapObject.h:51
MapObject()
Definition: MapObject.h:41
Position _newPosition
Definition: MapObject.h:52
void SetNewCellPosition(float x, float y, float z, float o)
Definition: MapObject.h:53
Cell const & GetCurrentCell() const
Definition: MapObject.h:48
Definition: Map.h:189
Definition: wmo.h:163
Definition: Cell.h:47
constexpr void Relocate(float x, float y)
Definition: Position.h:63