mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-30 02:15:34 +00:00
Fix unity build
This commit is contained in:
parent
3ea4305a60
commit
ce7f8c90f8
5 changed files with 76 additions and 63 deletions
|
@ -26,10 +26,10 @@
|
|||
#include <limits>
|
||||
#include <array>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
namespace
|
||||
{
|
||||
using namespace DetourNavigator;
|
||||
|
||||
struct Rectangle
|
||||
{
|
||||
TileBounds mBounds;
|
||||
|
@ -388,6 +388,7 @@ namespace
|
|||
return power;
|
||||
}
|
||||
}
|
||||
} // namespace DetourNavigator
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
|
|
|
@ -9,14 +9,11 @@
|
|||
#include <stdexcept>
|
||||
#include <tuple>
|
||||
|
||||
namespace
|
||||
inline bool operator==(const dtMeshHeader& lhs, const dtMeshHeader& rhs) noexcept
|
||||
{
|
||||
using DetourNavigator::ArrayRef;
|
||||
using DetourNavigator::Ref;
|
||||
using DetourNavigator::Span;
|
||||
|
||||
auto makeTuple(const dtMeshHeader& v)
|
||||
const auto makeTuple = [] (const dtMeshHeader& v)
|
||||
{
|
||||
using DetourNavigator::ArrayRef;
|
||||
return std::tuple(
|
||||
v.x,
|
||||
v.y,
|
||||
|
@ -39,47 +36,46 @@ namespace
|
|||
ArrayRef(v.bmax),
|
||||
v.bvQuantFactor
|
||||
);
|
||||
}
|
||||
|
||||
auto makeTuple(const dtPoly& v)
|
||||
{
|
||||
return std::tuple(ArrayRef(v.verts), ArrayRef(v.neis), v.flags, v.vertCount, v.areaAndtype);
|
||||
}
|
||||
|
||||
auto makeTuple(const dtPolyDetail& v)
|
||||
{
|
||||
return std::tuple(v.vertBase, v.triBase, v.vertCount, v.triCount);
|
||||
}
|
||||
|
||||
auto makeTuple(const dtBVNode& v)
|
||||
{
|
||||
return std::tuple(ArrayRef(v.bmin), ArrayRef(v.bmax), v.i);
|
||||
}
|
||||
|
||||
auto makeTuple(const dtOffMeshConnection& v)
|
||||
{
|
||||
return std::tuple(ArrayRef(v.pos), v.rad, v.poly, v.flags, v.side, v.userId);
|
||||
}
|
||||
|
||||
auto makeTuple(const DetourNavigator::NavMeshTileConstView& v)
|
||||
{
|
||||
return std::tuple(
|
||||
Ref(*v.mHeader),
|
||||
Span(v.mPolys, v.mHeader->polyCount),
|
||||
Span(v.mVerts, v.mHeader->vertCount),
|
||||
Span(v.mDetailMeshes, v.mHeader->detailMeshCount),
|
||||
Span(v.mDetailVerts, v.mHeader->detailVertCount),
|
||||
Span(v.mDetailTris, v.mHeader->detailTriCount),
|
||||
Span(v.mBvTree, v.mHeader->bvNodeCount),
|
||||
Span(v.mOffMeshCons, v.mHeader->offMeshConCount)
|
||||
);
|
||||
}
|
||||
};
|
||||
return makeTuple(lhs) == makeTuple(rhs);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline auto operator==(const T& lhs, const T& rhs)
|
||||
-> std::enable_if_t<std::is_same_v<std::void_t<decltype(makeTuple(lhs))>, void>, bool>
|
||||
inline bool operator==(const dtPoly& lhs, const dtPoly& rhs) noexcept
|
||||
{
|
||||
const auto makeTuple = [] (const dtPoly& v)
|
||||
{
|
||||
using DetourNavigator::ArrayRef;
|
||||
return std::tuple(ArrayRef(v.verts), ArrayRef(v.neis), v.flags, v.vertCount, v.areaAndtype);
|
||||
};
|
||||
return makeTuple(lhs) == makeTuple(rhs);
|
||||
}
|
||||
|
||||
inline bool operator==(const dtPolyDetail& lhs, const dtPolyDetail& rhs) noexcept
|
||||
{
|
||||
const auto makeTuple = [] (const dtPolyDetail& v)
|
||||
{
|
||||
return std::tuple(v.vertBase, v.triBase, v.vertCount, v.triCount);
|
||||
};
|
||||
return makeTuple(lhs) == makeTuple(rhs);
|
||||
}
|
||||
|
||||
inline bool operator==(const dtBVNode& lhs, const dtBVNode& rhs) noexcept
|
||||
{
|
||||
const auto makeTuple = [] (const dtBVNode& v)
|
||||
{
|
||||
using DetourNavigator::ArrayRef;
|
||||
return std::tuple(ArrayRef(v.bmin), ArrayRef(v.bmax), v.i);
|
||||
};
|
||||
return makeTuple(lhs) == makeTuple(rhs);
|
||||
}
|
||||
|
||||
inline bool operator==(const dtOffMeshConnection& lhs, const dtOffMeshConnection& rhs) noexcept
|
||||
{
|
||||
const auto makeTuple = [] (const dtOffMeshConnection& v)
|
||||
{
|
||||
using DetourNavigator::ArrayRef;
|
||||
return std::tuple(ArrayRef(v.pos), v.rad, v.poly, v.flags, v.side, v.userId);
|
||||
};
|
||||
return makeTuple(lhs) == makeTuple(rhs);
|
||||
}
|
||||
|
||||
|
@ -139,8 +135,23 @@ namespace DetourNavigator
|
|||
return view;
|
||||
}
|
||||
|
||||
bool operator==(const NavMeshTileConstView& lhs, const NavMeshTileConstView& rhs)
|
||||
bool operator==(const NavMeshTileConstView& lhs, const NavMeshTileConstView& rhs) noexcept
|
||||
{
|
||||
using DetourNavigator::Ref;
|
||||
using DetourNavigator::Span;
|
||||
const auto makeTuple = [] (const DetourNavigator::NavMeshTileConstView& v)
|
||||
{
|
||||
return std::tuple(
|
||||
Ref(*v.mHeader),
|
||||
Span(v.mPolys, v.mHeader->polyCount),
|
||||
Span(v.mVerts, v.mHeader->vertCount),
|
||||
Span(v.mDetailMeshes, v.mHeader->detailMeshCount),
|
||||
Span(v.mDetailVerts, v.mHeader->detailVertCount),
|
||||
Span(v.mDetailTris, v.mHeader->detailTriCount),
|
||||
Span(v.mBvTree, v.mHeader->bvNodeCount),
|
||||
Span(v.mOffMeshCons, v.mHeader->offMeshConCount)
|
||||
);
|
||||
};
|
||||
return makeTuple(lhs) == makeTuple(rhs);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace DetourNavigator
|
|||
const dtBVNode* mBvTree;
|
||||
const dtOffMeshConnection* mOffMeshCons;
|
||||
|
||||
friend bool operator==(const NavMeshTileConstView& lhs, const NavMeshTileConstView& rhs);
|
||||
friend bool operator==(const NavMeshTileConstView& lhs, const NavMeshTileConstView& rhs) noexcept;
|
||||
};
|
||||
|
||||
NavMeshTileConstView asNavMeshTileConstView(const unsigned char* data);
|
||||
|
|
|
@ -6,8 +6,6 @@
|
|||
|
||||
namespace
|
||||
{
|
||||
using namespace DetourNavigator;
|
||||
|
||||
void initPolyMeshDetail(rcPolyMeshDetail& value) noexcept
|
||||
{
|
||||
value.meshes = nullptr;
|
||||
|
@ -26,13 +24,6 @@ namespace
|
|||
}
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline constexpr auto operator==(const T& lhs, const T& rhs) noexcept
|
||||
-> std::enable_if_t<std::is_same_v<std::void_t<decltype(makeTuple(lhs))>, void>, bool>
|
||||
{
|
||||
return makeTuple(lhs) == makeTuple(rhs);
|
||||
}
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
PreparedNavMeshData::PreparedNavMeshData() noexcept
|
||||
|
|
|
@ -9,10 +9,11 @@
|
|||
|
||||
#include <tuple>
|
||||
|
||||
namespace DetourNavigator
|
||||
inline bool operator==(const rcPolyMesh& lhs, const rcPolyMesh& rhs) noexcept
|
||||
{
|
||||
constexpr auto makeTuple(const rcPolyMesh& v) noexcept
|
||||
const auto makeTuple = [] (const rcPolyMesh& v)
|
||||
{
|
||||
using namespace DetourNavigator;
|
||||
return std::tuple(
|
||||
Span(v.verts, static_cast<int>(getVertsLength(v))),
|
||||
Span(v.polys, static_cast<int>(getPolysLength(v))),
|
||||
|
@ -26,18 +27,27 @@ namespace DetourNavigator
|
|||
v.borderSize,
|
||||
v.maxEdgeError
|
||||
);
|
||||
}
|
||||
};
|
||||
return makeTuple(lhs) == makeTuple(rhs);
|
||||
}
|
||||
|
||||
constexpr auto makeTuple(const rcPolyMeshDetail& v) noexcept
|
||||
inline bool operator==(const rcPolyMeshDetail& lhs, const rcPolyMeshDetail& rhs) noexcept
|
||||
{
|
||||
const auto makeTuple = [] (const rcPolyMeshDetail& v)
|
||||
{
|
||||
using namespace DetourNavigator;
|
||||
return std::tuple(
|
||||
Span(v.meshes, static_cast<int>(getMeshesLength(v))),
|
||||
Span(v.verts, static_cast<int>(getVertsLength(v))),
|
||||
Span(v.tris, static_cast<int>(getTrisLength(v)))
|
||||
);
|
||||
}
|
||||
};
|
||||
return makeTuple(lhs) == makeTuple(rhs);
|
||||
}
|
||||
|
||||
constexpr auto makeTuple(const PreparedNavMeshData& v) noexcept
|
||||
namespace DetourNavigator
|
||||
{
|
||||
inline auto makeTuple(const PreparedNavMeshData& v) noexcept
|
||||
{
|
||||
return std::tuple(
|
||||
v.mUserId,
|
||||
|
|
Loading…
Reference in a new issue