mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-05-02 14:57:59 +03:00
Support compilation with c++20
This commit is contained in:
parent
7e4e78b1a7
commit
42d6032c8b
9 changed files with 63 additions and 17 deletions
|
@ -733,7 +733,7 @@ namespace DetourNavigator
|
|||
{
|
||||
Stats result;
|
||||
result.mJobs = mQueue.size();
|
||||
result.mGetTileCount = mGetTileCount.load(std::memory_order::memory_order_relaxed);
|
||||
result.mGetTileCount = mGetTileCount.load(std::memory_order_relaxed);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -857,6 +857,6 @@ namespace DetourNavigator
|
|||
Log(Debug::Debug) << "Insert db tile by job " << job->mId;
|
||||
mDb->insertTile(mNextTileId, job->mWorldspace, job->mChangedTile,
|
||||
mVersion, job->mInput, serialize(*job->mGeneratedNavMeshData));
|
||||
++mNextTileId.t;
|
||||
++mNextTileId;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,14 +4,13 @@
|
|||
#include "tileposition.hpp"
|
||||
|
||||
#include <components/detournavigator/tilespositionsrange.hpp>
|
||||
#include <components/misc/strongtypedef.hpp>
|
||||
|
||||
#include <components/sqlite3/db.hpp>
|
||||
#include <components/sqlite3/statement.hpp>
|
||||
#include <components/sqlite3/transaction.hpp>
|
||||
#include <components/sqlite3/types.hpp>
|
||||
|
||||
#include <boost/serialization/strong_typedef.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
|
@ -28,10 +27,10 @@ struct sqlite3_stmt;
|
|||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
BOOST_STRONG_TYPEDEF(std::int64_t, TileId)
|
||||
BOOST_STRONG_TYPEDEF(std::int64_t, TileRevision)
|
||||
BOOST_STRONG_TYPEDEF(std::int64_t, TileVersion)
|
||||
BOOST_STRONG_TYPEDEF(std::int64_t, ShapeId)
|
||||
using TileId = Misc::StrongTypedef<std::int64_t, struct TiledIdTag>;
|
||||
using TileRevision = Misc::StrongTypedef<std::int64_t, struct TileRevisionTag>;
|
||||
using TileVersion = Misc::StrongTypedef<std::int64_t, struct TileVersionTag>;
|
||||
using ShapeId = Misc::StrongTypedef<std::int64_t, struct ShapeIdTag>;
|
||||
|
||||
struct Tile
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace DetourNavigator
|
|||
const ShapeId newShapeId = nextShapeId;
|
||||
db.insertShape(newShapeId, name, type, hashData);
|
||||
Log(Debug::Verbose) << "Added " << name << " " << type << " shape to navmeshdb with id " << newShapeId;
|
||||
++nextShapeId.t;
|
||||
++nextShapeId;
|
||||
return newShapeId;
|
||||
}
|
||||
}
|
||||
|
|
38
components/misc/strongtypedef.hpp
Normal file
38
components/misc/strongtypedef.hpp
Normal file
|
@ -0,0 +1,38 @@
|
|||
#ifndef OPENMW_COMPONENTS_MISC_STRONGTYPEDEF_H
|
||||
#define OPENMW_COMPONENTS_MISC_STRONGTYPEDEF_H
|
||||
|
||||
#include <utility>
|
||||
|
||||
namespace Misc
|
||||
{
|
||||
template <class T, class>
|
||||
struct StrongTypedef
|
||||
{
|
||||
T mValue;
|
||||
|
||||
StrongTypedef() = default;
|
||||
|
||||
explicit StrongTypedef(const T& value) : mValue(value) {}
|
||||
|
||||
explicit StrongTypedef(T&& value) : mValue(std::move(value)) {}
|
||||
|
||||
operator const T&() const { return mValue; }
|
||||
|
||||
operator T&() { return mValue; }
|
||||
|
||||
StrongTypedef& operator++()
|
||||
{
|
||||
++mValue;
|
||||
return *this;
|
||||
}
|
||||
|
||||
StrongTypedef operator++(int)
|
||||
{
|
||||
StrongTypedef copy(*this);
|
||||
operator++();
|
||||
return copy;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -493,7 +493,7 @@ void MWShadowTechnique::LightData::setLightData(osg::RefMatrix* lm, const osg::L
|
|||
lightDir.set(-lightPos.x(), -lightPos.y(), -lightPos.z());
|
||||
lightDir.normalize();
|
||||
OSG_INFO<<" Directional light, lightPos="<<lightPos<<", lightDir="<<lightDir<<std::endl;
|
||||
if (lightMatrix.valid() && *lightMatrix != osg::Matrixf(modelViewMatrix))
|
||||
if (lightMatrix.valid() && lightMatrix->operator==(osg::Matrixf(modelViewMatrix)))
|
||||
{
|
||||
OSG_INFO<<" Light matrix "<<*lightMatrix<<std::endl;
|
||||
osg::Matrix lightToLocalMatrix(*lightMatrix * osg::Matrix::inverse(modelViewMatrix) );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue