diff options
author | ccrs <ccrs@users.noreply.github.com> | 2017-08-12 01:40:25 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2020-08-23 00:45:46 +0200 |
commit | 97585597f0b1aff93873fe4d757556731bc0c1b2 (patch) | |
tree | fda9b11c6e7abb9e4d3a6108a09def640c3eb2af /src/server/game/Scripting/ScriptSystem.h | |
parent | a86870622dd02921c4d2e32983a5a98ee91e5263 (diff) |
Core/Movement: waypoint movement (#20121)
Following the work done in #19361 this is the cleanup and improvement of the related logic of waypoint management.
Ref 28050f3 #18020
(taking the good parts and ignoring the incomplete work)
(cherry picked from commit 7fff83d67526efff63867d41b9e036a19a9287b3)
Diffstat (limited to 'src/server/game/Scripting/ScriptSystem.h')
-rw-r--r-- | src/server/game/Scripting/ScriptSystem.h | 46 |
1 files changed, 13 insertions, 33 deletions
diff --git a/src/server/game/Scripting/ScriptSystem.h b/src/server/game/Scripting/ScriptSystem.h index f058bf886ee..772b99244f8 100644 --- a/src/server/game/Scripting/ScriptSystem.h +++ b/src/server/game/Scripting/ScriptSystem.h @@ -20,59 +20,39 @@ #include "Define.h" #include "Hash.h" +#include "WaypointDefines.h" #include <unordered_map> #include <vector> class Creature; struct SplineChainLink; -#define TEXT_SOURCE_RANGE -1000000 //the amount of entries each text source has available - -struct ScriptPointMove -{ - uint32 uiCreatureEntry; - uint32 uiPointId; - float fX; - float fY; - float fZ; - uint32 uiWaitTime; -}; - -typedef std::vector<ScriptPointMove> ScriptPointVector; +#define TEXT_SOURCE_RANGE -1000000 // the amount of entries each text source has available class TC_GAME_API SystemMgr { - private: - SystemMgr(); - ~SystemMgr(); - SystemMgr(SystemMgr const&) = delete; - SystemMgr& operator=(SystemMgr const&) = delete; - public: static SystemMgr* instance(); - typedef std::unordered_map<uint32, ScriptPointVector> PointMoveMap; - - //Database + // database void LoadScriptWaypoints(); void LoadScriptSplineChains(); - ScriptPointVector const* GetPointMoveList(uint32 creatureEntry) const - { - PointMoveMap::const_iterator itr = m_mPointMoveMap.find(creatureEntry); - - if (itr == m_mPointMoveMap.end()) - return nullptr; - - return &itr->second; - } + WaypointPath const* GetPath(uint32 creatureEntry) const; std::vector<SplineChainLink> const* GetSplineChain(uint32 entry, uint16 chainId) const; std::vector<SplineChainLink> const* GetSplineChain(Creature const* who, uint16 id) const; - protected: - PointMoveMap m_mPointMoveMap; //coordinates for waypoints + private: typedef std::pair<uint32, uint16> ChainKeyType; // creature entry + chain ID + + SystemMgr(); + ~SystemMgr(); + + SystemMgr(SystemMgr const&) = delete; + SystemMgr& operator=(SystemMgr const&) = delete; + + std::unordered_map<uint32, WaypointPath> _waypointStore; std::unordered_map<ChainKeyType, std::vector<SplineChainLink>> m_mSplineChainsMap; // spline chains }; |