mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Support unsigned settings values
This commit is contained in:
parent
2388b21f63
commit
624d8bc931
8 changed files with 28 additions and 28 deletions
|
@ -93,8 +93,7 @@ namespace Launcher
|
|||
|
||||
int getMaxNavMeshDbFileSizeMiB()
|
||||
{
|
||||
return static_cast<int>(
|
||||
Settings::Manager::getInt64("max navmeshdb file size", "Navigator") / (1024 * 1024));
|
||||
return Settings::Manager::getUInt64("max navmeshdb file size", "Navigator") / (1024 * 1024);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -318,8 +317,8 @@ QStringList Launcher::DataFilesPage::filesInProfile(const QString& profileName,
|
|||
void Launcher::DataFilesPage::saveSettings(const QString& profile)
|
||||
{
|
||||
if (const int value = ui.navMeshMaxSizeSpinBox->value(); value != getMaxNavMeshDbFileSizeMiB())
|
||||
Settings::Manager::setInt64(
|
||||
"max navmeshdb file size", "Navigator", static_cast<std::int64_t>(value) * 1024 * 1024);
|
||||
Settings::Manager::setUInt64(
|
||||
"max navmeshdb file size", "Navigator", static_cast<std::uint64_t>(std::max(0, value)) * 1024 * 1024);
|
||||
|
||||
QString profileName = profile;
|
||||
|
||||
|
|
|
@ -196,8 +196,7 @@ namespace NavMeshTool
|
|||
const osg::Vec3f agentHalfExtents
|
||||
= Settings::Manager::getVector3("default actor pathfind half extents", "Game");
|
||||
const DetourNavigator::AgentBounds agentBounds{ agentCollisionShape, agentHalfExtents };
|
||||
const std::uint64_t maxDbFileSize
|
||||
= static_cast<std::uint64_t>(Settings::Manager::getInt64("max navmeshdb file size", "Navigator"));
|
||||
const std::uint64_t maxDbFileSize = Settings::Manager::getUInt64("max navmeshdb file size", "Navigator");
|
||||
const auto dbPath = Files::pathToUnicodeString(config.getUserDataPath() / "navmesh.db");
|
||||
|
||||
DetourNavigator::NavMeshDb db(dbPath, maxDbFileSize);
|
||||
|
|
|
@ -123,7 +123,7 @@ namespace MWGui
|
|||
|
||||
void DebugWindow::startLogRecording()
|
||||
{
|
||||
sLogCircularBuffer.resize(std::max<int64_t>(0, Settings::Manager::getInt64("log buffer size", "General")));
|
||||
sLogCircularBuffer.resize(Settings::Manager::getSize("log buffer size", "General"));
|
||||
Debug::setLogListener([](Debug::Level level, std::string_view prefix, std::string_view msg) {
|
||||
if (sLogCircularBuffer.empty())
|
||||
return; // Log viewer is disabled.
|
||||
|
|
|
@ -43,10 +43,8 @@ namespace DetourNavigator
|
|||
= std::clamp(::Settings::Manager::getInt("max nav mesh query nodes", "Navigator"), 1, 65535);
|
||||
result.mMaxPolys
|
||||
= std::clamp(::Settings::Manager::getInt("max polygons per tile", "Navigator"), 1, (1 << 22) - 1);
|
||||
result.mMaxPolygonPathSize
|
||||
= static_cast<std::size_t>(std::max(0, ::Settings::Manager::getInt("max polygon path size", "Navigator")));
|
||||
result.mMaxSmoothPathSize
|
||||
= static_cast<std::size_t>(std::max(0, ::Settings::Manager::getInt("max smooth path size", "Navigator")));
|
||||
result.mMaxPolygonPathSize = ::Settings::Manager::getSize("max polygon path size", "Navigator");
|
||||
result.mMaxSmoothPathSize = ::Settings::Manager::getSize("max smooth path size", "Navigator");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -60,10 +58,9 @@ namespace DetourNavigator
|
|||
result.mMaxTilesNumber = std::max(0, ::Settings::Manager::getInt("max tiles number", "Navigator"));
|
||||
result.mWaitUntilMinDistanceToPlayer
|
||||
= ::Settings::Manager::getInt("wait until min distance to player", "Navigator");
|
||||
result.mAsyncNavMeshUpdaterThreads = static_cast<std::size_t>(
|
||||
std::max(0, ::Settings::Manager::getInt("async nav mesh updater threads", "Navigator")));
|
||||
result.mMaxNavMeshTilesCacheSize = static_cast<std::size_t>(
|
||||
std::max(std::int64_t{ 0 }, ::Settings::Manager::getInt64("max nav mesh tiles cache size", "Navigator")));
|
||||
result.mAsyncNavMeshUpdaterThreads
|
||||
= ::Settings::Manager::getSize("async nav mesh updater threads", "Navigator");
|
||||
result.mMaxNavMeshTilesCacheSize = ::Settings::Manager::getSize("max nav mesh tiles cache size", "Navigator");
|
||||
result.mEnableWriteRecastMeshToFile
|
||||
= ::Settings::Manager::getBool("enable write recast mesh to file", "Navigator");
|
||||
result.mEnableWriteNavMeshToFile = ::Settings::Manager::getBool("enable write nav mesh to file", "Navigator");
|
||||
|
@ -77,8 +74,7 @@ namespace DetourNavigator
|
|||
= std::chrono::milliseconds(::Settings::Manager::getInt("min update interval ms", "Navigator"));
|
||||
result.mEnableNavMeshDiskCache = ::Settings::Manager::getBool("enable nav mesh disk cache", "Navigator");
|
||||
result.mWriteToNavMeshDb = ::Settings::Manager::getBool("write to navmeshdb", "Navigator");
|
||||
result.mMaxDbFileSize
|
||||
= static_cast<std::uint64_t>(::Settings::Manager::getInt64("max navmeshdb file size", "Navigator"));
|
||||
result.mMaxDbFileSize = ::Settings::Manager::getUInt64("max navmeshdb file size", "Navigator");
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -152,9 +152,14 @@ namespace Settings
|
|||
return parseIntegralNumber<int>(getString(setting, category), setting, category);
|
||||
}
|
||||
|
||||
std::int64_t Manager::getInt64(std::string_view setting, std::string_view category)
|
||||
std::uint64_t Manager::getUInt64(std::string_view setting, std::string_view category)
|
||||
{
|
||||
return parseIntegralNumber<std::int64_t>(getString(setting, category), setting, category);
|
||||
return parseIntegralNumber<std::uint64_t>(getString(setting, category), setting, category);
|
||||
}
|
||||
|
||||
std::size_t Manager::getSize(std::string_view setting, std::string_view category)
|
||||
{
|
||||
return parseIntegralNumber<std::size_t>(getString(setting, category), setting, category);
|
||||
}
|
||||
|
||||
bool Manager::getBool(std::string_view setting, std::string_view category)
|
||||
|
@ -227,7 +232,7 @@ namespace Settings
|
|||
setString(setting, category, stream.str());
|
||||
}
|
||||
|
||||
void Manager::setInt64(std::string_view setting, std::string_view category, const std::int64_t value)
|
||||
void Manager::setUInt64(std::string_view setting, std::string_view category, const std::uint64_t value)
|
||||
{
|
||||
std::ostringstream stream;
|
||||
stream << value;
|
||||
|
|
|
@ -61,7 +61,8 @@ namespace Settings
|
|||
///< returns the list of changed settings intersecting with the filter
|
||||
|
||||
static int getInt(std::string_view setting, std::string_view category);
|
||||
static std::int64_t getInt64(std::string_view setting, std::string_view category);
|
||||
static std::uint64_t getUInt64(std::string_view setting, std::string_view category);
|
||||
static std::size_t getSize(std::string_view setting, std::string_view category);
|
||||
static float getFloat(std::string_view setting, std::string_view category);
|
||||
static double getDouble(std::string_view setting, std::string_view category);
|
||||
static const std::string& getString(std::string_view setting, std::string_view category);
|
||||
|
@ -71,7 +72,7 @@ namespace Settings
|
|||
static osg::Vec3f getVector3(std::string_view setting, std::string_view category);
|
||||
|
||||
static void setInt(std::string_view setting, std::string_view category, int value);
|
||||
static void setInt64(std::string_view setting, std::string_view category, std::int64_t value);
|
||||
static void setUInt64(std::string_view setting, std::string_view category, std::uint64_t value);
|
||||
static void setFloat(std::string_view setting, std::string_view category, float value);
|
||||
static void setDouble(std::string_view setting, std::string_view category, double value);
|
||||
static void setString(std::string_view setting, std::string_view category, const std::string& value);
|
||||
|
|
|
@ -90,7 +90,7 @@ Two highest priority locales may be assigned via the Localization tab of the in-
|
|||
log buffer size
|
||||
---------------
|
||||
|
||||
:Type: integer
|
||||
:Type: platform dependant unsigned integer
|
||||
:Range: >= 0
|
||||
:Default: 65536
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ If true generated navmesh tiles will be stored into disk cache while game is run
|
|||
max navmeshdb file size
|
||||
-----------------------
|
||||
|
||||
:Type: integer
|
||||
:Type: unsigned 64-bit integer
|
||||
:Range: > 0
|
||||
:Default: 2147483648
|
||||
|
||||
|
@ -91,7 +91,7 @@ This section is for advanced PC uses who understands concepts of OS thread and m
|
|||
async nav mesh updater threads
|
||||
------------------------------
|
||||
|
||||
:Type: integer
|
||||
:Type: platform dependant unsigned integer
|
||||
:Range: >= 1
|
||||
:Default: 1
|
||||
|
||||
|
@ -103,7 +103,7 @@ Don't expect twice better latency by doubling this value.
|
|||
max nav mesh tiles cache size
|
||||
-----------------------------
|
||||
|
||||
:Type: integer
|
||||
:Type: platform dependant unsigned integer
|
||||
:Range: >= 0
|
||||
:Default: 268435456
|
||||
|
||||
|
@ -279,7 +279,7 @@ Pay attention to slopes and roofs when change it. Increasing this value will red
|
|||
max polygon path size
|
||||
---------------------
|
||||
|
||||
:Type: integer
|
||||
:Type: platform dependant unsigned integer
|
||||
:Range: > 0
|
||||
:Default: 1024
|
||||
|
||||
|
@ -288,7 +288,7 @@ Maximum size of path over polygons.
|
|||
max smooth path size
|
||||
--------------------
|
||||
|
||||
:Type: integer
|
||||
:Type: platform dependant unsigned integer
|
||||
:Range: > 0
|
||||
:Default: 1024
|
||||
|
||||
|
|
Loading…
Reference in a new issue