mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-31 01:23:47 +00:00
refactor(Core): rename namespaces and macros to acore (#2454)
This commit is contained in:
@@ -308,7 +308,7 @@ template<>
|
||||
void Map::SwitchGridContainers(Creature* obj, bool on)
|
||||
{
|
||||
ASSERT(!obj->IsPermanentWorldObject());
|
||||
CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
|
||||
CellCoord p = acore::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
|
||||
if (!p.IsCoordValid())
|
||||
{
|
||||
sLog->outError("Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
|
||||
@@ -347,7 +347,7 @@ template<>
|
||||
void Map::SwitchGridContainers(GameObject* obj, bool on)
|
||||
{
|
||||
ASSERT(!obj->IsPermanentWorldObject());
|
||||
CellCoord p = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
|
||||
CellCoord p = acore::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
|
||||
if (!p.IsCoordValid())
|
||||
{
|
||||
sLog->outError("Map::SwitchGridContainers: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord);
|
||||
@@ -404,7 +404,7 @@ void Map::EnsureGridCreated(const GridCoord &p)
|
||||
{
|
||||
if (getNGrid(p.x_coord, p.y_coord)) // pussywizard
|
||||
return;
|
||||
TRINITY_GUARD(ACE_Thread_Mutex, GridLock);
|
||||
ACORE_GUARD(ACE_Thread_Mutex, GridLock);
|
||||
EnsureGridCreated_i(p);
|
||||
}
|
||||
|
||||
@@ -478,7 +478,7 @@ void Map::LoadAllCells()
|
||||
|
||||
bool Map::AddPlayerToMap(Player* player)
|
||||
{
|
||||
CellCoord cellCoord = Trinity::ComputeCellCoord(player->GetPositionX(), player->GetPositionY());
|
||||
CellCoord cellCoord = acore::ComputeCellCoord(player->GetPositionX(), player->GetPositionY());
|
||||
if (!cellCoord.IsCoordValid())
|
||||
{
|
||||
sLog->outError("Map::Add: Player (GUID: %u) has invalid coordinates X:%f Y:%f grid cell [%u:%u]", player->GetGUIDLow(), player->GetPositionX(), player->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
|
||||
@@ -533,7 +533,7 @@ bool Map::AddToMap(T* obj, bool checkTransport)
|
||||
return true;
|
||||
}
|
||||
|
||||
CellCoord cellCoord = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
|
||||
CellCoord cellCoord = acore::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
|
||||
//It will create many problems (including crashes) if an object is not added to grid after creation
|
||||
//The correct way to fix it is to make AddToMap return false and delete the object if it is not added to grid
|
||||
//But now AddToMap is used in too many places, I will just see how many ASSERT failures it will cause
|
||||
@@ -585,7 +585,7 @@ bool Map::AddToMap(MotionTransport* obj, bool /*checkTransport*/)
|
||||
if (obj->IsInWorld())
|
||||
return true;
|
||||
|
||||
CellCoord cellCoord = Trinity::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
|
||||
CellCoord cellCoord = acore::ComputeCellCoord(obj->GetPositionX(), obj->GetPositionY());
|
||||
if (!cellCoord.IsCoordValid())
|
||||
{
|
||||
sLog->outError("Map::Add: Object " UI64FMTD " has invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), cellCoord.x_coord, cellCoord.y_coord);
|
||||
@@ -627,10 +627,11 @@ bool Map::IsGridLoaded(const GridCoord &p) const
|
||||
return (getNGrid(p.x_coord, p.y_coord) && isGridObjectDataLoaded(p.x_coord, p.y_coord));
|
||||
}
|
||||
|
||||
void Map::VisitNearbyCellsOfPlayer(Player* player, TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer> &gridVisitor,
|
||||
TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer> &worldVisitor,
|
||||
TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer> &largeGridVisitor,
|
||||
TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer> &largeWorldVisitor)
|
||||
|
||||
void Map::VisitNearbyCellsOfPlayer(Player* player, TypeContainerVisitor<acore::ObjectUpdater, GridTypeMapContainer> &gridVisitor,
|
||||
TypeContainerVisitor<acore::ObjectUpdater, WorldTypeMapContainer> &worldVisitor,
|
||||
TypeContainerVisitor<acore::ObjectUpdater, GridTypeMapContainer> &largeGridVisitor,
|
||||
TypeContainerVisitor<acore::ObjectUpdater, WorldTypeMapContainer> &largeWorldVisitor)
|
||||
{
|
||||
// check for valid position
|
||||
if (!player->IsPositionValid())
|
||||
@@ -662,10 +663,10 @@ void Map::VisitNearbyCellsOfPlayer(Player* player, TypeContainerVisitor<Trinity:
|
||||
}
|
||||
}
|
||||
|
||||
void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer> &gridVisitor,
|
||||
TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer> &worldVisitor,
|
||||
TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer> &largeGridVisitor,
|
||||
TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer> &largeWorldVisitor)
|
||||
void Map::VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<acore::ObjectUpdater, GridTypeMapContainer> &gridVisitor,
|
||||
TypeContainerVisitor<acore::ObjectUpdater, WorldTypeMapContainer> &worldVisitor,
|
||||
TypeContainerVisitor<acore::ObjectUpdater, GridTypeMapContainer> &largeGridVisitor,
|
||||
TypeContainerVisitor<acore::ObjectUpdater, WorldTypeMapContainer> &largeWorldVisitor)
|
||||
{
|
||||
// Check for valid position
|
||||
if (!obj->IsPositionValid())
|
||||
@@ -746,16 +747,17 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
|
||||
resetMarkedCells();
|
||||
resetMarkedCellsLarge();
|
||||
|
||||
Trinity::ObjectUpdater updater(t_diff, false);
|
||||
acore::ObjectUpdater updater(t_diff, false);
|
||||
|
||||
// for creature
|
||||
TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer > grid_object_update(updater);
|
||||
TypeContainerVisitor<acore::ObjectUpdater, GridTypeMapContainer > grid_object_update(updater);
|
||||
// for pets
|
||||
TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer > world_object_update(updater);
|
||||
TypeContainerVisitor<acore::ObjectUpdater, WorldTypeMapContainer > world_object_update(updater);
|
||||
|
||||
// for large creatures
|
||||
Trinity::ObjectUpdater largeObjectUpdater(t_diff, true);
|
||||
TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer > grid_large_object_update(largeObjectUpdater);
|
||||
TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer > world_large_object_update(largeObjectUpdater);
|
||||
acore::ObjectUpdater largeObjectUpdater(t_diff, true);
|
||||
TypeContainerVisitor<acore::ObjectUpdater, GridTypeMapContainer > grid_large_object_update(largeObjectUpdater);
|
||||
TypeContainerVisitor<acore::ObjectUpdater, WorldTypeMapContainer > world_large_object_update(largeObjectUpdater);
|
||||
|
||||
// pussywizard: container for far creatures in combat with players
|
||||
std::vector<Creature*> updateList; updateList.reserve(10);
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#ifndef TRINITY_MAP_H
|
||||
#define TRINITY_MAP_H
|
||||
#ifndef ACORE_MAP_H
|
||||
#define ACORE_MAP_H
|
||||
|
||||
// Pathfinding
|
||||
#include "DetourAlloc.h"
|
||||
@@ -51,7 +51,7 @@ class BattlegroundMap;
|
||||
class Transport;
|
||||
class StaticTransport;
|
||||
class MotionTransport;
|
||||
namespace Trinity
|
||||
namespace acore
|
||||
{
|
||||
struct ObjectUpdater;
|
||||
struct LargeObjectUpdater;
|
||||
@@ -296,14 +296,15 @@ class Map : public GridRefManager<NGridType>
|
||||
template<class T> bool AddToMap(T *, bool checkTransport = false);
|
||||
template<class T> void RemoveFromMap(T *, bool);
|
||||
|
||||
void VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer> &gridVisitor,
|
||||
TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer> &worldVisitor,
|
||||
TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer> &largeGridVisitor,
|
||||
TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer> &largeWorldVisitor);
|
||||
void VisitNearbyCellsOfPlayer(Player* player, TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer> &gridVisitor,
|
||||
TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer> &worldVisitor,
|
||||
TypeContainerVisitor<Trinity::ObjectUpdater, GridTypeMapContainer> &largeGridVisitor,
|
||||
TypeContainerVisitor<Trinity::ObjectUpdater, WorldTypeMapContainer> &largeWorldVisitor);
|
||||
void VisitNearbyCellsOf(WorldObject* obj, TypeContainerVisitor<acore::ObjectUpdater, GridTypeMapContainer> &gridVisitor,
|
||||
TypeContainerVisitor<acore::ObjectUpdater, WorldTypeMapContainer> &worldVisitor,
|
||||
TypeContainerVisitor<acore::ObjectUpdater, GridTypeMapContainer> &largeGridVisitor,
|
||||
TypeContainerVisitor<acore::ObjectUpdater, WorldTypeMapContainer> &largeWorldVisitor);
|
||||
void VisitNearbyCellsOfPlayer(Player* player, TypeContainerVisitor<acore::ObjectUpdater, GridTypeMapContainer> &gridVisitor,
|
||||
TypeContainerVisitor<acore::ObjectUpdater, WorldTypeMapContainer> &worldVisitor,
|
||||
TypeContainerVisitor<acore::ObjectUpdater, GridTypeMapContainer> &largeGridVisitor,
|
||||
TypeContainerVisitor<acore::ObjectUpdater, WorldTypeMapContainer> &largeWorldVisitor);
|
||||
|
||||
virtual void Update(const uint32, const uint32, bool thread = true);
|
||||
|
||||
float GetVisibilityRange() const { return m_VisibleDistance; }
|
||||
@@ -320,13 +321,13 @@ class Map : public GridRefManager<NGridType>
|
||||
|
||||
bool IsRemovalGrid(float x, float y) const
|
||||
{
|
||||
GridCoord p = Trinity::ComputeGridCoord(x, y);
|
||||
GridCoord p = acore::ComputeGridCoord(x, y);
|
||||
return !getNGrid(p.x_coord, p.y_coord);
|
||||
}
|
||||
|
||||
bool IsGridLoaded(float x, float y) const
|
||||
{
|
||||
return IsGridLoaded(Trinity::ComputeGridCoord(x, y));
|
||||
return IsGridLoaded(acore::ComputeGridCoord(x, y));
|
||||
}
|
||||
|
||||
void LoadGrid(float x, float y);
|
||||
@@ -737,7 +738,7 @@ inline void Map::Visit(Cell const& cell, TypeContainerVisitor<T, CONTAINER>& vis
|
||||
template<class NOTIFIER>
|
||||
inline void Map::VisitAll(float const& x, float const& y, float radius, NOTIFIER& notifier)
|
||||
{
|
||||
CellCoord p(Trinity::ComputeCellCoord(x, y));
|
||||
CellCoord p(acore::ComputeCellCoord(x, y));
|
||||
Cell cell(p);
|
||||
cell.SetNoCreate();
|
||||
|
||||
@@ -751,7 +752,7 @@ inline void Map::VisitAll(float const& x, float const& y, float radius, NOTIFIER
|
||||
template<class NOTIFIER>
|
||||
inline void Map::VisitFirstFound(const float &x, const float &y, float radius, NOTIFIER ¬ifier)
|
||||
{
|
||||
CellCoord p(Trinity::ComputeCellCoord(x, y));
|
||||
CellCoord p(acore::ComputeCellCoord(x, y));
|
||||
Cell cell(p);
|
||||
cell.SetNoCreate();
|
||||
|
||||
@@ -767,7 +768,7 @@ inline void Map::VisitFirstFound(const float &x, const float &y, float radius, N
|
||||
template<class NOTIFIER>
|
||||
inline void Map::VisitWorld(const float &x, const float &y, float radius, NOTIFIER ¬ifier)
|
||||
{
|
||||
CellCoord p(Trinity::ComputeCellCoord(x, y));
|
||||
CellCoord p(acore::ComputeCellCoord(x, y));
|
||||
Cell cell(p);
|
||||
cell.SetNoCreate();
|
||||
|
||||
@@ -778,7 +779,7 @@ inline void Map::VisitWorld(const float &x, const float &y, float radius, NOTIFI
|
||||
template<class NOTIFIER>
|
||||
inline void Map::VisitGrid(const float &x, const float &y, float radius, NOTIFIER ¬ifier)
|
||||
{
|
||||
CellCoord p(Trinity::ComputeCellCoord(x, y));
|
||||
CellCoord p(acore::ComputeCellCoord(x, y));
|
||||
Cell cell(p);
|
||||
cell.SetNoCreate();
|
||||
|
||||
|
||||
@@ -175,7 +175,7 @@ Map* MapInstanced::CreateInstanceForPlayer(const uint32 mapId, Player* player)
|
||||
InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty)
|
||||
{
|
||||
// load/create a map
|
||||
TRINITY_GUARD(ACE_Thread_Mutex, Lock);
|
||||
ACORE_GUARD(ACE_Thread_Mutex, Lock);
|
||||
|
||||
// make sure we have a valid map id
|
||||
const MapEntry* entry = sMapStore.LookupEntry(GetId());
|
||||
@@ -218,7 +218,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save,
|
||||
BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battleground* bg)
|
||||
{
|
||||
// load/create a map
|
||||
TRINITY_GUARD(ACE_Thread_Mutex, Lock);
|
||||
ACORE_GUARD(ACE_Thread_Mutex, Lock);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_MAPS, "MapInstanced::CreateBattleground: map bg %d for %d created.", InstanceId, GetId());
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#ifndef TRINITY_MAP_INSTANCED_H
|
||||
#define TRINITY_MAP_INSTANCED_H
|
||||
#ifndef ACORE_MAP_INSTANCED_H
|
||||
#define ACORE_MAP_INSTANCED_H
|
||||
|
||||
#include "Map.h"
|
||||
#include "InstanceSaveMgr.h"
|
||||
|
||||
@@ -63,7 +63,7 @@ Map* MapManager::CreateBaseMap(uint32 id)
|
||||
|
||||
if (map == NULL)
|
||||
{
|
||||
TRINITY_GUARD(ACE_Thread_Mutex, Lock);
|
||||
ACORE_GUARD(ACE_Thread_Mutex, Lock);
|
||||
|
||||
map = FindBaseMap(id);
|
||||
if (map == NULL) // pussywizard: check again after acquiring mutex
|
||||
@@ -154,7 +154,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck)
|
||||
{
|
||||
// probably there must be special opcode, because client has this string constant in GlobalStrings.lua
|
||||
// TODO: this is not a good place to send the message
|
||||
player->GetSession()->SendAreaTriggerMessage(player->GetSession()->GetTrinityString(LANG_INSTANCE_RAID_GROUP_ONLY), mapName);
|
||||
player->GetSession()->SendAreaTriggerMessage(player->GetSession()->GetAcoreString(LANG_INSTANCE_RAID_GROUP_ONLY), mapName);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' must be in a raid group to enter instance '%s'", player->GetName().c_str(), mapName);
|
||||
#endif
|
||||
@@ -299,7 +299,7 @@ void MapManager::DoDelayedMovesAndRemoves()
|
||||
|
||||
bool MapManager::ExistMapAndVMap(uint32 mapid, float x, float y)
|
||||
{
|
||||
GridCoord p = Trinity::ComputeGridCoord(x, y);
|
||||
GridCoord p = acore::ComputeGridCoord(x, y);
|
||||
|
||||
int gx=63-p.x_coord;
|
||||
int gy=63-p.y_coord;
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
*/
|
||||
|
||||
#ifndef TRINITY_MAPMANAGER_H
|
||||
#define TRINITY_MAPMANAGER_H
|
||||
#ifndef ACORE_MAPMANAGER_H
|
||||
#define ACORE_MAPMANAGER_H
|
||||
|
||||
#include "Define.h"
|
||||
#include <ace/Singleton.h>
|
||||
@@ -72,17 +72,17 @@ class MapManager
|
||||
|
||||
static bool IsValidMapCoord(uint32 mapid, float x, float y)
|
||||
{
|
||||
return IsValidMAP(mapid, false) && Trinity::IsValidMapCoord(x, y);
|
||||
return IsValidMAP(mapid, false) && acore::IsValidMapCoord(x, y);
|
||||
}
|
||||
|
||||
static bool IsValidMapCoord(uint32 mapid, float x, float y, float z)
|
||||
{
|
||||
return IsValidMAP(mapid, false) && Trinity::IsValidMapCoord(x, y, z);
|
||||
return IsValidMAP(mapid, false) && acore::IsValidMapCoord(x, y, z);
|
||||
}
|
||||
|
||||
static bool IsValidMapCoord(uint32 mapid, float x, float y, float z, float o)
|
||||
{
|
||||
return IsValidMAP(mapid, false) && Trinity::IsValidMapCoord(x, y, z, o);
|
||||
return IsValidMAP(mapid, false) && acore::IsValidMapCoord(x, y, z, o);
|
||||
}
|
||||
|
||||
static bool IsValidMapCoord(WorldLocation const& loc)
|
||||
|
||||
@@ -105,7 +105,7 @@ int MapUpdater::deactivate()
|
||||
|
||||
int MapUpdater::wait()
|
||||
{
|
||||
TRINITY_GUARD(ACE_Thread_Mutex, m_mutex);
|
||||
ACORE_GUARD(ACE_Thread_Mutex, m_mutex);
|
||||
|
||||
while (pending_requests > 0)
|
||||
m_condition.wait();
|
||||
@@ -115,7 +115,7 @@ int MapUpdater::wait()
|
||||
|
||||
int MapUpdater::schedule_update(Map& map, uint32 diff, uint32 s_diff)
|
||||
{
|
||||
TRINITY_GUARD(ACE_Thread_Mutex, m_mutex);
|
||||
ACORE_GUARD(ACE_Thread_Mutex, m_mutex);
|
||||
|
||||
++pending_requests;
|
||||
|
||||
@@ -132,7 +132,7 @@ int MapUpdater::schedule_update(Map& map, uint32 diff, uint32 s_diff)
|
||||
|
||||
int MapUpdater::schedule_lfg_update(uint32 diff)
|
||||
{
|
||||
TRINITY_GUARD(ACE_Thread_Mutex, m_mutex);
|
||||
ACORE_GUARD(ACE_Thread_Mutex, m_mutex);
|
||||
|
||||
++pending_requests;
|
||||
|
||||
@@ -154,7 +154,7 @@ bool MapUpdater::activated()
|
||||
|
||||
void MapUpdater::update_finished()
|
||||
{
|
||||
TRINITY_GUARD(ACE_Thread_Mutex, m_mutex);
|
||||
ACORE_GUARD(ACE_Thread_Mutex, m_mutex);
|
||||
|
||||
if (pending_requests == 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user