mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Movement: waypoint movement (#20121)
Following the work done in #19361 this is the cleanup and improvement of the related logic of waypoint management. Ref28050f3#18020 (taking the good parts and ignoring the incomplete work) (cherry picked from commit7fff83d675)
This commit is contained in:
@@ -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
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user