mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Build: Fixed game & collision depending on each other for linking
This commit is contained in:
@@ -17,9 +17,7 @@
|
||||
*/
|
||||
|
||||
#include "MMapFactory.h"
|
||||
#include "World.h"
|
||||
#include "Config.h"
|
||||
#include "DisableMgr.h"
|
||||
|
||||
namespace MMAP
|
||||
{
|
||||
@@ -35,12 +33,6 @@ namespace MMAP
|
||||
return g_MMapManager;
|
||||
}
|
||||
|
||||
bool MMapFactory::IsPathfindingEnabled(uint32 mapId)
|
||||
{
|
||||
return sWorld->getBoolConfig(CONFIG_ENABLE_MMAPS)
|
||||
&& !DisableMgr::IsDisabledFor(DISABLE_TYPE_MMAP, mapId, NULL, MMAP_DISABLE_PATHFINDING);
|
||||
}
|
||||
|
||||
void MMapFactory::clear()
|
||||
{
|
||||
if (g_MMapManager)
|
||||
|
||||
@@ -25,8 +25,6 @@
|
||||
#include "ModelInstance.h"
|
||||
#include "WorldModel.h"
|
||||
#include <G3D/Vector3.h>
|
||||
#include "DisableMgr.h"
|
||||
#include "DBCStores.h"
|
||||
#include "Log.h"
|
||||
#include "VMapDefinitions.h"
|
||||
|
||||
@@ -36,6 +34,8 @@ namespace VMAP
|
||||
{
|
||||
VMapManager2::VMapManager2()
|
||||
{
|
||||
GetLiquidFlagsPtr = &GetLiquidFlagsDummy;
|
||||
IsVMAPDisabledForPtr = &IsVMAPDisabledForDummy;
|
||||
}
|
||||
|
||||
VMapManager2::~VMapManager2(void)
|
||||
@@ -134,7 +134,7 @@ namespace VMAP
|
||||
|
||||
bool VMapManager2::isInLineOfSight(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2)
|
||||
{
|
||||
if (!isLineOfSightCalcEnabled() || DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS))
|
||||
if (!isLineOfSightCalcEnabled() || IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LOS))
|
||||
return true;
|
||||
|
||||
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||
@@ -157,7 +157,7 @@ namespace VMAP
|
||||
*/
|
||||
bool VMapManager2::getObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist)
|
||||
{
|
||||
if (isLineOfSightCalcEnabled() && !DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS))
|
||||
if (isLineOfSightCalcEnabled() && !IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LOS))
|
||||
{
|
||||
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||
if (instanceTree != iInstanceMapTrees.end())
|
||||
@@ -187,7 +187,7 @@ namespace VMAP
|
||||
|
||||
float VMapManager2::getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist)
|
||||
{
|
||||
if (isHeightCalcEnabled() && !DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_HEIGHT))
|
||||
if (isHeightCalcEnabled() && !IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_HEIGHT))
|
||||
{
|
||||
InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||
if (instanceTree != iInstanceMapTrees.end())
|
||||
@@ -206,7 +206,7 @@ namespace VMAP
|
||||
|
||||
bool VMapManager2::getAreaInfo(unsigned int mapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const
|
||||
{
|
||||
if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_AREAFLAG))
|
||||
if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_AREAFLAG))
|
||||
{
|
||||
InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||
if (instanceTree != iInstanceMapTrees.end())
|
||||
@@ -224,7 +224,7 @@ namespace VMAP
|
||||
|
||||
bool VMapManager2::GetLiquidLevel(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type) const
|
||||
{
|
||||
if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LIQUIDSTATUS))
|
||||
if (!IsVMAPDisabledForPtr(mapId, VMAP_DISABLE_LIQUIDSTATUS))
|
||||
{
|
||||
InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId);
|
||||
if (instanceTree != iInstanceMapTrees.end())
|
||||
@@ -236,7 +236,7 @@ namespace VMAP
|
||||
floor = info.ground_Z;
|
||||
ASSERT(floor < std::numeric_limits<float>::max());
|
||||
type = info.hitModel->GetLiquidType(); // entry from LiquidType.dbc
|
||||
if (reqLiquidType && !(GetLiquidFlags(type) & reqLiquidType))
|
||||
if (reqLiquidType && !(GetLiquidFlagsPtr(type) & reqLiquidType))
|
||||
return false;
|
||||
if (info.hitInstance->GetLiquidLevel(pos, info, level))
|
||||
return true;
|
||||
|
||||
@@ -66,6 +66,14 @@ namespace VMAP
|
||||
typedef std::unordered_map<uint32, StaticMapTree*> InstanceTreeMap;
|
||||
typedef std::unordered_map<std::string, ManagedModel> ModelFileMap;
|
||||
|
||||
enum DisableTypes
|
||||
{
|
||||
VMAP_DISABLE_AREAFLAG = 0x1,
|
||||
VMAP_DISABLE_HEIGHT = 0x2,
|
||||
VMAP_DISABLE_LOS = 0x4,
|
||||
VMAP_DISABLE_LIQUIDSTATUS = 0x8
|
||||
};
|
||||
|
||||
class VMapManager2 : public IVMapManager
|
||||
{
|
||||
protected:
|
||||
@@ -78,6 +86,9 @@ namespace VMAP
|
||||
bool _loadMap(uint32 mapId, const std::string& basePath, uint32 tileX, uint32 tileY);
|
||||
/* void _unloadMap(uint32 pMapId, uint32 x, uint32 y); */
|
||||
|
||||
static uint32 GetLiquidFlagsDummy(uint32) { return 0; }
|
||||
static bool IsVMAPDisabledForDummy(uint32 /*entry*/, uint8 /*flags*/) { return false; }
|
||||
|
||||
public:
|
||||
// public for debug
|
||||
G3D::Vector3 convertPositionToInternalRep(float x, float y, float z) const;
|
||||
@@ -114,6 +125,12 @@ namespace VMAP
|
||||
virtual bool existsMap(const char* basePath, unsigned int mapId, int x, int y) override;
|
||||
public:
|
||||
void getInstanceMapTree(InstanceTreeMap &instanceMapTree);
|
||||
|
||||
typedef uint32(*GetLiquidFlagsFn)(uint32 liquidType);
|
||||
GetLiquidFlagsFn GetLiquidFlagsPtr;
|
||||
|
||||
typedef bool(*IsVMAPDisabledForFn)(uint32 entry, uint8 flags);
|
||||
IsVMAPDisabledForFn IsVMAPDisabledForPtr;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
#include "ObjectMgr.h"
|
||||
#include "OutdoorPvP.h"
|
||||
#include "SpellMgr.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "Player.h"
|
||||
#include "World.h"
|
||||
|
||||
namespace DisableMgr
|
||||
{
|
||||
@@ -193,28 +193,28 @@ void LoadDisables()
|
||||
switch (mapEntry->map_type)
|
||||
{
|
||||
case MAP_COMMON:
|
||||
if (flags & VMAP_DISABLE_AREAFLAG)
|
||||
if (flags & VMAP::VMAP_DISABLE_AREAFLAG)
|
||||
TC_LOG_INFO("misc", "Areaflag disabled for world map %u.", entry);
|
||||
if (flags & VMAP_DISABLE_LIQUIDSTATUS)
|
||||
if (flags & VMAP::VMAP_DISABLE_LIQUIDSTATUS)
|
||||
TC_LOG_INFO("misc", "Liquid status disabled for world map %u.", entry);
|
||||
break;
|
||||
case MAP_INSTANCE:
|
||||
case MAP_RAID:
|
||||
if (flags & VMAP_DISABLE_HEIGHT)
|
||||
if (flags & VMAP::VMAP_DISABLE_HEIGHT)
|
||||
TC_LOG_INFO("misc", "Height disabled for instance map %u.", entry);
|
||||
if (flags & VMAP_DISABLE_LOS)
|
||||
if (flags & VMAP::VMAP_DISABLE_LOS)
|
||||
TC_LOG_INFO("misc", "LoS disabled for instance map %u.", entry);
|
||||
break;
|
||||
case MAP_BATTLEGROUND:
|
||||
if (flags & VMAP_DISABLE_HEIGHT)
|
||||
if (flags & VMAP::VMAP_DISABLE_HEIGHT)
|
||||
TC_LOG_INFO("misc", "Height disabled for battleground map %u.", entry);
|
||||
if (flags & VMAP_DISABLE_LOS)
|
||||
if (flags & VMAP::VMAP_DISABLE_LOS)
|
||||
TC_LOG_INFO("misc", "LoS disabled for battleground map %u.", entry);
|
||||
break;
|
||||
case MAP_ARENA:
|
||||
if (flags & VMAP_DISABLE_HEIGHT)
|
||||
if (flags & VMAP::VMAP_DISABLE_HEIGHT)
|
||||
TC_LOG_INFO("misc", "Height disabled for arena map %u.", entry);
|
||||
if (flags & VMAP_DISABLE_LOS)
|
||||
if (flags & VMAP::VMAP_DISABLE_LOS)
|
||||
TC_LOG_INFO("misc", "LoS disabled for arena map %u.", entry);
|
||||
break;
|
||||
default:
|
||||
@@ -387,4 +387,15 @@ bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IsVMAPDisabledFor(uint32 entry, uint8 flags)
|
||||
{
|
||||
return IsDisabledFor(DISABLE_TYPE_VMAP, entry, NULL, flags);
|
||||
}
|
||||
|
||||
bool IsPathfindingEnabled(uint32 mapId)
|
||||
{
|
||||
return sWorld->getBoolConfig(CONFIG_ENABLE_MMAPS)
|
||||
&& !IsDisabledFor(DISABLE_TYPE_MMAP, mapId, NULL, MMAP_DISABLE_PATHFINDING);
|
||||
}
|
||||
|
||||
} // Namespace
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#ifndef TRINITY_DISABLEMGR_H
|
||||
#define TRINITY_DISABLEMGR_H
|
||||
|
||||
#include "VMapManager2.h"
|
||||
#include "Define.h"
|
||||
|
||||
class Unit;
|
||||
@@ -49,14 +50,6 @@ enum SpellDisableTypes
|
||||
SPELL_DISABLE_LOS)
|
||||
};
|
||||
|
||||
enum VmapDisableTypes
|
||||
{
|
||||
VMAP_DISABLE_AREAFLAG = 0x1,
|
||||
VMAP_DISABLE_HEIGHT = 0x2,
|
||||
VMAP_DISABLE_LOS = 0x4,
|
||||
VMAP_DISABLE_LIQUIDSTATUS = 0x8
|
||||
};
|
||||
|
||||
enum MMapDisableTypes
|
||||
{
|
||||
MMAP_DISABLE_PATHFINDING = 0x0
|
||||
@@ -67,6 +60,8 @@ namespace DisableMgr
|
||||
void LoadDisables();
|
||||
bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags = 0);
|
||||
void CheckQuestDisables();
|
||||
bool IsVMAPDisabledFor(uint32 entry, uint8 flags);
|
||||
bool IsPathfindingEnabled(uint32 mapId);
|
||||
}
|
||||
|
||||
#endif //TRINITY_DISABLEMGR_H
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
#include "Battleground.h"
|
||||
#include "MMapFactory.h"
|
||||
#include "CellImpl.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "DynamicTree.h"
|
||||
#include "GridNotifiers.h"
|
||||
#include "GridNotifiersImpl.h"
|
||||
@@ -119,7 +120,7 @@ bool Map::ExistVMap(uint32 mapid, int gx, int gy)
|
||||
|
||||
void Map::LoadMMap(int gx, int gy)
|
||||
{
|
||||
if (!MMAP::MMapFactory::IsPathfindingEnabled(GetId()))
|
||||
if (!DisableMgr::IsPathfindingEnabled(GetId()))
|
||||
return;
|
||||
|
||||
bool mmapLoadResult = MMAP::MMapFactory::createOrGetMMapManager()->loadMap((sWorld->GetDataPath() + "mmaps").c_str(), GetId(), gx, gy);
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
#include "MMapFactory.h"
|
||||
#include "MMapManager.h"
|
||||
#include "Log.h"
|
||||
|
||||
#include "DisableMgr.h"
|
||||
#include "DetourCommon.h"
|
||||
#include "DetourNavMeshQuery.h"
|
||||
|
||||
@@ -38,7 +38,7 @@ PathGenerator::PathGenerator(const Unit* owner) :
|
||||
TC_LOG_DEBUG("maps", "++ PathGenerator::PathGenerator for %u \n", _sourceUnit->GetGUIDLow());
|
||||
|
||||
uint32 mapId = _sourceUnit->GetMapId();
|
||||
if (MMAP::MMapFactory::IsPathfindingEnabled(mapId))
|
||||
if (DisableMgr::IsPathfindingEnabled(mapId))
|
||||
{
|
||||
MMAP::MMapManager* mmap = MMAP::MMapFactory::createOrGetMMapManager();
|
||||
_navMesh = mmap->GetNavMesh(mapId);
|
||||
|
||||
@@ -1283,6 +1283,13 @@ void World::SetInitialWorldSettings()
|
||||
///- Initialize detour memory management
|
||||
dtAllocSetCustom(dtCustomAlloc, dtCustomFree);
|
||||
|
||||
///- Initialize VMapManager function pointers (to untangle game/collision circular deps)
|
||||
if (VMAP::VMapManager2* vmmgr2 = dynamic_cast<VMAP::VMapManager2*>(VMAP::VMapFactory::createOrGetVMapManager()))
|
||||
{
|
||||
vmmgr2->GetLiquidFlagsPtr = &GetLiquidFlags;
|
||||
vmmgr2->IsVMAPDisabledForPtr = &DisableMgr::IsVMAPDisabledFor;
|
||||
}
|
||||
|
||||
///- Initialize config settings
|
||||
LoadConfigSettings();
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "LFG.h"
|
||||
#include "GroupMgr.h"
|
||||
#include "MMapFactory.h"
|
||||
#include "DisableMgr.h"
|
||||
|
||||
class misc_commandscript : public CommandScript
|
||||
{
|
||||
@@ -186,7 +187,7 @@ public:
|
||||
|
||||
uint32 haveMap = Map::ExistMap(mapId, gridX, gridY) ? 1 : 0;
|
||||
uint32 haveVMap = Map::ExistVMap(mapId, gridX, gridY) ? 1 : 0;
|
||||
uint32 haveMMap = (MMAP::MMapFactory::IsPathfindingEnabled(mapId) && MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId())) ? 1 : 0;
|
||||
uint32 haveMMap = (DisableMgr::IsPathfindingEnabled(mapId) && MMAP::MMapFactory::createOrGetMMapManager()->GetNavMesh(handler->GetSession()->GetPlayer()->GetMapId())) ? 1 : 0;
|
||||
|
||||
if (haveVMap)
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Chat.h"
|
||||
#include "DisableMgr.h"
|
||||
#include "ObjectMgr.h"
|
||||
#include "Player.h"
|
||||
#include "PointMovementGenerator.h"
|
||||
@@ -209,7 +210,7 @@ public:
|
||||
{
|
||||
uint32 mapId = handler->GetSession()->GetPlayer()->GetMapId();
|
||||
handler->PSendSysMessage("mmap stats:");
|
||||
handler->PSendSysMessage(" global mmap pathfinding is %sabled", MMAP::MMapFactory::IsPathfindingEnabled(mapId) ? "en" : "dis");
|
||||
handler->PSendSysMessage(" global mmap pathfinding is %sabled", DisableMgr::IsPathfindingEnabled(mapId) ? "en" : "dis");
|
||||
|
||||
MMAP::MMapManager* manager = MMAP::MMapFactory::createOrGetMMapManager();
|
||||
handler->PSendSysMessage(" %u maps loaded with %u tiles overall", manager->getLoadedMapsCount(), manager->getLoadedTilesCount());
|
||||
|
||||
@@ -27,14 +27,6 @@
|
||||
#include "DetourNavMesh.h"
|
||||
#include "DetourCommon.h"
|
||||
|
||||
#include "DisableMgr.h"
|
||||
|
||||
uint32 GetLiquidFlags(uint32 /*liquidType*/) { return 0; }
|
||||
namespace DisableMgr
|
||||
{
|
||||
bool IsDisabledFor(DisableType /*type*/, uint32 /*entry*/, Unit const* /*unit*/, uint8 /*flags*/ /*= 0*/) { return false; }
|
||||
}
|
||||
|
||||
#define MMAP_MAGIC 0x4d4d4150 // 'MMAP'
|
||||
#define MMAP_VERSION 5
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace MMAP
|
||||
if (*++filter == '\0') // wildcard at end of filter means all remaing chars match
|
||||
return true;
|
||||
|
||||
while (true)
|
||||
for (;;)
|
||||
{
|
||||
if (*filter == *str)
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user