TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
WaypointManager.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef TRINITY_WAYPOINTMANAGER_H
20 #define TRINITY_WAYPOINTMANAGER_H
21 
22 #include <vector>
23 
25 {
30 
32 };
33 
35 {
37  float x, y, z, orientation;
42 };
43 
44 typedef std::vector<WaypointData*> WaypointPath;
45 typedef std::unordered_map<uint32, WaypointPath> WaypointPathContainer;
46 
48 {
49  public:
50  static WaypointMgr* instance();
51 
52  // Attempts to reload a single path from database
53  void ReloadPath(uint32 id);
54 
55  // Loads all paths from database, should only run on startup
56  void Load();
57 
58  // Returns the path from a given id
59  WaypointPath const* GetPath(uint32 id) const
60  {
61  WaypointPathContainer::const_iterator itr = _waypointStore.find(id);
62  if (itr != _waypointStore.end())
63  return &itr->second;
64 
65  return NULL;
66  }
67 
68  private:
69  WaypointMgr();
70  ~WaypointMgr();
71 
73 };
74 
75 #define sWaypointMgr WaypointMgr::instance()
76 
77 #endif
uint32 event_id
Definition: WaypointManager.h:39
Definition: WaypointManager.h:29
float x
Definition: WaypointManager.h:37
uint32 id
Definition: WaypointManager.h:36
WaypointPath const * GetPath(uint32 id) const
Definition: WaypointManager.h:59
float z
Definition: WaypointManager.h:37
arena_t NULL
Definition: jemalloc_internal.h:624
std::vector< WaypointData * > WaypointPath
Definition: WaypointManager.h:44
float orientation
Definition: WaypointManager.h:37
Definition: WaypointManager.h:47
float y
Definition: WaypointManager.h:37
Definition: WaypointManager.h:28
WaypointMoveType
Definition: WaypointManager.h:24
uint8 event_chance
Definition: WaypointManager.h:41
uint32_t uint32
Definition: Define.h:150
std::unordered_map< uint32, WaypointPath > WaypointPathContainer
Definition: WaypointManager.h:45
Definition: WaypointManager.h:26
uint32 move_type
Definition: WaypointManager.h:40
#define TC_GAME_API
Definition: Define.h:134
uint32 delay
Definition: WaypointManager.h:38
uint8_t uint8
Definition: Define.h:152
Definition: WaypointManager.h:27
WaypointPathContainer _waypointStore
Definition: WaypointManager.h:72
Definition: WaypointManager.h:31
Definition: WaypointManager.h:34