aboutsummaryrefslogtreecommitdiff
path: root/src/common/Collision/DynamicTree.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2024-11-19 20:20:33 +0100
committerShauren <shauren.trinity@gmail.com>2024-11-19 20:20:33 +0100
commitb4d6ca277aef81a49e3654a3eec131ea621da991 (patch)
tree0fab0b7393f63a2baead5915e64b03d71c3173fd /src/common/Collision/DynamicTree.cpp
parent225a1bbf7dabdc318bd340e15afa7378a7622612 (diff)
Core/vmaps: Removed vmap lookup functions duplicating functionality of each other
(cherry picked from commit 45ee989c70682c001d4467d97bf1ecedcf7dbcc3)
Diffstat (limited to 'src/common/Collision/DynamicTree.cpp')
-rw-r--r--src/common/Collision/DynamicTree.cpp46
1 files changed, 8 insertions, 38 deletions
diff --git a/src/common/Collision/DynamicTree.cpp b/src/common/Collision/DynamicTree.cpp
index 34c38d98fa7..ceddd740613 100644
--- a/src/common/Collision/DynamicTree.cpp
+++ b/src/common/Collision/DynamicTree.cpp
@@ -150,22 +150,6 @@ struct DynamicTreeIntersectionCallback
bool didHit() const { return did_hit;}
};
-struct DynamicTreeAreaInfoCallback
-{
- DynamicTreeAreaInfoCallback(uint32 phaseMask) : _phaseMask(phaseMask) {}
-
- void operator()(G3D::Vector3 const& p, GameObjectModel const& obj)
- {
- obj.intersectPoint(p, _areaInfo, _phaseMask);
- }
-
- VMAP::AreaInfo const& GetAreaInfo() const { return _areaInfo; }
-
-private:
- uint32 _phaseMask;
- VMAP::AreaInfo _areaInfo;
-};
-
struct DynamicTreeLocationInfoCallback
{
DynamicTreeLocationInfoCallback(uint32 phaseMask) : _phaseMask(phaseMask), _hitModel(nullptr) {}
@@ -265,24 +249,7 @@ float DynamicMapTree::getHeight(float x, float y, float z, float maxSearchDist,
return -G3D::finf();
}
-bool DynamicMapTree::getAreaInfo(float x, float y, float& z, uint32 phasemask, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const
-{
- G3D::Vector3 v(x, y, z + 0.5f);
- DynamicTreeAreaInfoCallback intersectionCallBack(phasemask);
- impl->intersectPoint(v, intersectionCallBack);
- if (intersectionCallBack.GetAreaInfo().result)
- {
- flags = intersectionCallBack.GetAreaInfo().flags;
- adtId = intersectionCallBack.GetAreaInfo().adtId;
- rootId = intersectionCallBack.GetAreaInfo().rootId;
- groupId = intersectionCallBack.GetAreaInfo().groupId;
- z = intersectionCallBack.GetAreaInfo().ground_Z;
- return true;
- }
- return false;
-}
-
-void DynamicMapTree::getAreaAndLiquidData(float x, float y, float z, uint32 phasemask, uint8 reqLiquidType, VMAP::AreaAndLiquidData& data) const
+bool DynamicMapTree::getAreaAndLiquidData(float x, float y, float z, uint32 phasemask, Optional<uint8> reqLiquidType, VMAP::AreaAndLiquidData& data) const
{
G3D::Vector3 v(x, y, z + 0.5f);
DynamicTreeLocationInfoCallback intersectionCallBack(phasemask);
@@ -292,13 +259,16 @@ void DynamicMapTree::getAreaAndLiquidData(float x, float y, float z, uint32 phas
data.floorZ = intersectionCallBack.GetLocationInfo().ground_Z;
uint32 liquidType = intersectionCallBack.GetLocationInfo().hitModel->GetLiquidType();
float liquidLevel;
- if (!reqLiquidType || 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);
- data.areaInfo.emplace(0,
+ data.areaInfo.emplace(intersectionCallBack.GetLocationInfo().hitModel->GetWmoID(),
+ 0,
intersectionCallBack.GetLocationInfo().rootId,
- intersectionCallBack.GetLocationInfo().hitModel->GetWmoID(),
- intersectionCallBack.GetLocationInfo().hitModel->GetMogpFlags());
+ intersectionCallBack.GetLocationInfo().hitModel->GetMogpFlags(),
+ 0);
+ return true;
}
+ return false;
}