diff options
author | Anubisss <none@none> | 2010-05-13 00:08:30 +0200 |
---|---|---|
committer | Anubisss <none@none> | 2010-05-13 00:08:30 +0200 |
commit | 4a448eca37a5a5409d39d4036db3793cfa27edf8 (patch) | |
tree | 62c1cb0ec5962173ad0cfafa36a3d513846e813f /src/game/WaypointManager.h | |
parent | 8223af6576f17e4e402600bae844c5e7c6d74bda (diff) |
Make WaypointMgr to singleton.
Move global waypoint_map variable to WaypointMgr's private variable.
--HG--
branch : trunk
Diffstat (limited to 'src/game/WaypointManager.h')
-rw-r--r-- | src/game/WaypointManager.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/game/WaypointManager.h b/src/game/WaypointManager.h index 20a5dcc256f..b70d07a9b9b 100644 --- a/src/game/WaypointManager.h +++ b/src/game/WaypointManager.h @@ -21,6 +21,8 @@ #ifndef TRINITY_WAYPOINTMANAGER_H #define TRINITY_WAYPOINTMANAGER_H +#include <ace/Singleton.h> +#include <ace/Null_Mutex.h> #include <vector> struct WaypointData @@ -34,14 +36,17 @@ struct WaypointData }; typedef std::vector<WaypointData*> WaypointPath; -extern UNORDERED_MAP<uint32, WaypointPath*> waypoint_map; class WaypointStore { private : uint32 records; + UNORDERED_MAP<uint32, WaypointPath*> waypoint_map; public: + // Null Mutex is OK because WaypointMgr is initialized in the World thread before World is initialized + static WaypointStore* instance() { return ACE_Singleton<WaypointStore, ACE_Null_Mutex>::instance(); } + void UpdatePath(uint32 id); void Load(); void Free(); @@ -56,7 +61,7 @@ class WaypointStore inline uint32 GetRecordsCount() { return records; } }; -extern WaypointStore WaypointMgr; +#define sWaypointMgr WaypointStore::instance() #endif |