Core/Misc: Fix issues reported by static analysis (#25351)
* Core/Misc: Fix issues reported by static analysis
* Core/Vmaps: Code cleanup after e777161888
(cherry picked from commit cfc8f7b442a9dba07b198fcebe2c02ab89cf0a8b)
This commit is contained in:
@@ -293,7 +293,7 @@ void DynamicMapTree::getAreaAndLiquidData(float x, float y, float z, PhaseShift
|
||||
data.floorZ = intersectionCallBack.GetLocationInfo().ground_Z;
|
||||
uint32 liquidType = intersectionCallBack.GetLocationInfo().hitModel->GetLiquidType();
|
||||
float liquidLevel;
|
||||
if (!reqLiquidType || (dynamic_cast<VMAP::VMapManager2*>(VMAP::VMapFactory::createOrGetVMapManager())->GetLiquidFlagsPtr(liquidType) & reqLiquidType))
|
||||
if (!reqLiquidType || VMAP::VMapFactory::createOrGetVMapManager()->GetLiquidFlagsPtr(liquidType) & reqLiquidType)
|
||||
if (intersectionCallBack.GetHitModel()->GetLiquidLevel(v, intersectionCallBack.GetLocationInfo(), liquidLevel))
|
||||
data.liquidInfo.emplace(liquidType, liquidLevel);
|
||||
|
||||
|
||||
@@ -20,14 +20,14 @@
|
||||
|
||||
namespace VMAP
|
||||
{
|
||||
IVMapManager* gVMapManager = nullptr;
|
||||
VMapManager2* gVMapManager = nullptr;
|
||||
|
||||
//===============================================
|
||||
// just return the instance
|
||||
IVMapManager* VMapFactory::createOrGetVMapManager()
|
||||
VMapManager2* VMapFactory::createOrGetVMapManager()
|
||||
{
|
||||
if (gVMapManager == nullptr)
|
||||
gVMapManager= new VMapManager2(); // should be taken from config ... Please change if you like :-)
|
||||
gVMapManager= new VMapManager2();
|
||||
return gVMapManager;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,12 +26,12 @@ This is the access point to the VMapManager.
|
||||
|
||||
namespace VMAP
|
||||
{
|
||||
//===========================================================
|
||||
class VMapManager2;
|
||||
|
||||
class TC_COMMON_API VMapFactory
|
||||
{
|
||||
public:
|
||||
static IVMapManager* createOrGetVMapManager();
|
||||
static VMapManager2* createOrGetVMapManager();
|
||||
static void clear();
|
||||
};
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ void LoadGameObjectModelList(std::string const& dataPath)
|
||||
GameObjectModel::~GameObjectModel()
|
||||
{
|
||||
if (iModel)
|
||||
((VMAP::VMapManager2*)VMAP::VMapFactory::createOrGetVMapManager())->releaseModelInstance(iModel->GetName());
|
||||
VMAP::VMapFactory::createOrGetVMapManager()->releaseModelInstance(iModel->GetName());
|
||||
}
|
||||
|
||||
bool GameObjectModel::initialize(std::unique_ptr<GameObjectModelOwnerBase> modelOwner, std::string const& dataPath)
|
||||
@@ -115,7 +115,7 @@ bool GameObjectModel::initialize(std::unique_ptr<GameObjectModelOwnerBase> model
|
||||
return false;
|
||||
}
|
||||
|
||||
iModel = ((VMAP::VMapManager2*)VMAP::VMapFactory::createOrGetVMapManager())->acquireModelInstance(dataPath + "vmaps/", it->second.name);
|
||||
iModel = VMAP::VMapFactory::createOrGetVMapManager()->acquireModelInstance(dataPath + "vmaps/", it->second.name);
|
||||
|
||||
if (!iModel)
|
||||
return false;
|
||||
|
||||
@@ -201,9 +201,7 @@ void UnitAI::FillAISpellInfo()
|
||||
if (AIInfo->cooldown.count() < int32(spellInfo->RecoveryTime))
|
||||
AIInfo->cooldown = Milliseconds(spellInfo->RecoveryTime);
|
||||
|
||||
if (!spellInfo->GetMaxRange(false))
|
||||
UPDATE_TARGET(AITARGET_SELF)
|
||||
else
|
||||
if (spellInfo->GetMaxRange(false))
|
||||
{
|
||||
for (SpellEffectInfo const& effect : spellInfo->GetEffects())
|
||||
{
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include "Util.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "Vehicle.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
#include <G3D/Vector3.h>
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
#include "TransportMgr.h"
|
||||
#include "Vehicle.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "World.h"
|
||||
#include <G3D/g3dmath.h>
|
||||
#include <numeric>
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
#include "Transport.h"
|
||||
#include "Vehicle.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "Weather.h"
|
||||
#include "WeatherMgr.h"
|
||||
#include "World.h"
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "Player.h"
|
||||
#include "ScenarioMgr.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "World.h"
|
||||
|
||||
MapInstanced::MapInstanced(uint32 id, time_t expiry) : Map(id, expiry, 0, DIFFICULTY_NORMAL)
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
#include "Util.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "Vehicle.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
#include <numeric>
|
||||
|
||||
@@ -1689,11 +1689,9 @@ void World::SetInitialWorldSettings()
|
||||
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 = &DB2Manager::GetLiquidFlags;
|
||||
vmmgr2->IsVMAPDisabledForPtr = &DisableMgr::IsVMAPDisabledFor;
|
||||
}
|
||||
VMAP::VMapManager2* vmmgr2 = VMAP::VMapFactory::createOrGetVMapManager();
|
||||
vmmgr2->GetLiquidFlagsPtr = &DB2Manager::GetLiquidFlags;
|
||||
vmmgr2->IsVMAPDisabledForPtr = &DisableMgr::IsVMAPDisabledFor;
|
||||
|
||||
///- Initialize config settings
|
||||
LoadConfigSettings();
|
||||
@@ -1785,8 +1783,7 @@ void World::SetInitialWorldSettings()
|
||||
|
||||
sMapMgr->InitializeParentMapData(mapData);
|
||||
|
||||
if (VMAP::VMapManager2* vmmgr2 = dynamic_cast<VMAP::VMapManager2*>(VMAP::VMapFactory::createOrGetVMapManager()))
|
||||
vmmgr2->InitializeThreadUnsafe(mapData);
|
||||
vmmgr2->InitializeThreadUnsafe(mapData);
|
||||
|
||||
MMAP::MMapManager* mmmgr = MMAP::MMapFactory::createOrGetMMapManager();
|
||||
mmmgr->InitializeThreadUnsafe(mapData);
|
||||
|
||||
@@ -39,6 +39,7 @@ EndScriptData */
|
||||
#include "UpdateTime.h"
|
||||
#include "Util.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "VMapManager2.h"
|
||||
#include "World.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user