Support compilation with c++20

ccache_for_windows
elsid 3 years ago
parent 7e4e78b1a7
commit 42d6032c8b
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

@ -137,7 +137,7 @@ namespace NavMeshTool
{
std::lock_guard lock(mMutex);
mDb.insertTile(mNextTileId, worldspace, tilePosition, TileVersion {version}, input, serialize(data));
++mNextTileId.t;
++mNextTileId;
}
++mInserted;
report();

@ -163,7 +163,7 @@ bool Actor::setPosition(const osg::Vec3f& position)
{
std::scoped_lock lock(mPositionMutex);
applyOffsetChange();
bool hasChanged = (mPosition != position && !mSkipSimulation) || mWorldPositionChanged;
bool hasChanged = (mPosition.operator!=(position) && !mSkipSimulation) || mWorldPositionChanged;
if (!mSkipSimulation)
{
mPreviousPosition = mPosition;

@ -156,7 +156,7 @@ namespace
for (int y = -2; y <= 2; ++y)
{
ASSERT_EQ(mDb.insertTile(tileId, worldspace, TilePosition {x, y}, version, input, data), 1);
++tileId.t;
++tileId;
}
}
const TilesPositionsRange range {TilePosition {-1, -1}, TilePosition {2, 2}};

@ -17,9 +17,18 @@ namespace
namespace bpo = boost::program_options;
std::vector<std::string> generateSupportedCharacters(std::vector<std::string>&& base = {})
template <class T, std::size_t size>
std::string makeString(const T (&range)[size])
{
std::vector<std::string> result = std::move(base);
static_assert(size > 0);
return std::string(std::begin(range), std::end(range) - 1);
}
template <class ... Args>
std::vector<std::string> generateSupportedCharacters(Args&& ... args)
{
std::vector<std::string> result;
(result.emplace_back(makeString(args)) , ...);
for (int i = 1; i <= std::numeric_limits<char>::max(); ++i)
if (i != '&' && i != '"' && i != ' ' && i != '\n')
result.push_back(std::string(1, i));
@ -193,7 +202,7 @@ namespace
INSTANTIATE_TEST_SUITE_P(
SupportedCharacters,
OpenMWOptionsFromArgumentsStrings,
ValuesIn(generateSupportedCharacters({u8"👍", u8"Ъ", u8"Ǽ", "\n"}))
ValuesIn(generateSupportedCharacters(u8"👍", u8"Ъ", u8"Ǽ", "\n"))
);
TEST(OpenMWOptionsFromConfig, should_support_single_word_load_savegame_path)
@ -381,6 +390,6 @@ namespace
INSTANTIATE_TEST_SUITE_P(
SupportedCharacters,
OpenMWOptionsFromConfigStrings,
ValuesIn(generateSupportedCharacters({u8"👍", u8"Ъ", u8"Ǽ"}))
ValuesIn(generateSupportedCharacters(u8"👍", u8"Ъ", u8"Ǽ"))
);
}

@ -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;
}
}

@ -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…
Cancel
Save