mirror of
https://github.com/mangosfour/server.git
synced 2025-12-19 13:37:01 +00:00
[8182] Store and use Map* pointer in WorldObject instead map ids for speedup
Also some code logic cleanups. Changes let make more cleanups in base map access and other places, but this chnages not inlcuded in patch. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
fcb34b3928
commit
58209ee79a
25 changed files with 180 additions and 193 deletions
|
|
@ -245,7 +245,7 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
|
|||
{
|
||||
friend class MapReference;
|
||||
public:
|
||||
Map(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode);
|
||||
Map(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode, Map* _parent = NULL);
|
||||
virtual ~Map();
|
||||
|
||||
// currently unused for normal maps
|
||||
|
|
@ -300,6 +300,8 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
|
|||
static void InitStateMachine();
|
||||
static void DeleteStateMachine();
|
||||
|
||||
Map const * GetParent() const { return m_parentMap; }
|
||||
|
||||
// some calls like isInWater should not use vmaps due to processor power
|
||||
// can return INVALID_HEIGHT if under z+2 z coord not found height
|
||||
float GetHeight(float x, float y, float z, bool pCheckVMap=true) const;
|
||||
|
|
@ -461,6 +463,10 @@ class MANGOS_DLL_SPEC Map : public GridRefManager<NGridType>, public MaNGOS::Obj
|
|||
ActiveNonPlayers m_activeNonPlayers;
|
||||
ActiveNonPlayers::iterator m_activeNonPlayersIter;
|
||||
private:
|
||||
//used for fast base_map (e.g. MapInstanced class object) search for
|
||||
//InstanceMaps and BattleGroundMaps...
|
||||
Map* m_parentMap;
|
||||
|
||||
typedef GridReadGuard ReadGuard;
|
||||
typedef GridWriteGuard WriteGuard;
|
||||
|
||||
|
|
@ -520,7 +526,7 @@ enum InstanceResetMethod
|
|||
class MANGOS_DLL_SPEC InstanceMap : public Map
|
||||
{
|
||||
public:
|
||||
InstanceMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode);
|
||||
InstanceMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode, Map* _parent);
|
||||
~InstanceMap();
|
||||
bool Add(Player *);
|
||||
void Remove(Player *, bool);
|
||||
|
|
@ -545,7 +551,7 @@ class MANGOS_DLL_SPEC InstanceMap : public Map
|
|||
class MANGOS_DLL_SPEC BattleGroundMap : public Map
|
||||
{
|
||||
public:
|
||||
BattleGroundMap(uint32 id, time_t, uint32 InstanceId);
|
||||
BattleGroundMap(uint32 id, time_t, uint32 InstanceId, Map* _parent);
|
||||
~BattleGroundMap();
|
||||
|
||||
bool Add(Player *);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue