From c39f0880a281ba0eb4215517bcc63f4c0e548a37 Mon Sep 17 00:00:00 2001 From: elsid Date: Wed, 1 Apr 2026 14:56:38 -0700 Subject: [PATCH 1/6] Use span for off mesh connections --- components/detournavigator/makenavmesh.cpp | 10 +++++----- components/detournavigator/makenavmesh.hpp | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/components/detournavigator/makenavmesh.cpp b/components/detournavigator/makenavmesh.cpp index 06bb693aad..ef875cce0d 100644 --- a/components/detournavigator/makenavmesh.cpp +++ b/components/detournavigator/makenavmesh.cpp @@ -33,7 +33,7 @@ namespace DetourNavigator float mHeight; }; - std::vector getOffMeshVerts(const std::vector& connections) + std::vector getOffMeshVerts(std::span connections) { std::vector result; @@ -72,7 +72,7 @@ namespace DetourNavigator return Flag_none; } - std::vector getOffMeshConAreas(const std::vector& connections) + std::vector getOffMeshConAreas(std::span connections) { std::vector result; result.reserve(connections.size()); @@ -81,7 +81,7 @@ namespace DetourNavigator return result; } - std::vector getOffMeshFlags(const std::vector& connections) + std::vector getOffMeshFlags(std::span connections) { std::vector result; result.reserve(connections.size()); @@ -550,8 +550,8 @@ namespace DetourNavigator } NavMeshData makeNavMeshTileData(const PreparedNavMeshData& data, - const std::vector& offMeshConnections, const AgentBounds& agentBounds, - const TilePosition& tile, const RecastSettings& settings) + std::span offMeshConnections, const AgentBounds& agentBounds, const TilePosition& tile, + const RecastSettings& settings) { const auto offMeshConVerts = getOffMeshVerts(offMeshConnections); const std::vector offMeshConRad(offMeshConnections.size(), getRadius(settings, agentBounds)); diff --git a/components/detournavigator/makenavmesh.hpp b/components/detournavigator/makenavmesh.hpp index d78f946230..4fc31f615c 100644 --- a/components/detournavigator/makenavmesh.hpp +++ b/components/detournavigator/makenavmesh.hpp @@ -7,7 +7,7 @@ #include #include -#include +#include class dtNavMesh; struct rcConfig; @@ -47,8 +47,8 @@ namespace DetourNavigator const TilePosition& tilePosition, const AgentBounds& agentBounds, const RecastSettings& settings); NavMeshData makeNavMeshTileData(const PreparedNavMeshData& data, - const std::vector& offMeshConnections, const AgentBounds& agentBounds, - const TilePosition& tile, const RecastSettings& settings); + std::span offMeshConnections, const AgentBounds& agentBounds, const TilePosition& tile, + const RecastSettings& settings); void initEmptyNavMesh(const Settings& settings, dtNavMesh& navMesh); From 8c7e649de0cf9dc1d7b6bdd8726b35c7809e3e2c Mon Sep 17 00:00:00 2001 From: elsid Date: Wed, 1 Apr 2026 14:57:46 -0700 Subject: [PATCH 2/6] Report max polygons count per navmesh tile in navmeshtool Useful to understand optimal values for Navigator settings: * max polygons per tile * max tiles number --- apps/navmeshtool/main.cpp | 27 +++++++- apps/navmeshtool/navmesh.cpp | 61 ++++++++++++++----- apps/navmeshtool/navmesh.hpp | 19 +++++- .../detournavigator/generatenavmeshtile.cpp | 30 ++++++++- .../detournavigator/generatenavmeshtile.hpp | 13 +++- 5 files changed, 126 insertions(+), 24 deletions(-) diff --git a/apps/navmeshtool/main.cpp b/apps/navmeshtool/main.cpp index 15d3d079c6..3f2bd7eded 100644 --- a/apps/navmeshtool/main.cpp +++ b/apps/navmeshtool/main.cpp @@ -120,6 +120,9 @@ namespace NavMeshTool addOption("write-binary-log", bpo::value()->implicit_value(true)->default_value(false), "write progress in binary messages to be consumed by the launcher"); + addOption("collect-stats", bpo::value()->implicit_value(true)->default_value(false), + "collect statistics for generated navmesh tiles including existing ones stored in database"); + addOption("worldspace-filter", bpo::value()->default_value(".*"), "Regular expression to filter in specified worldspaces in modified ECMAScript grammar (see " "https://en.cppreference.com/w/cpp/regex/ecmascript.html)"); @@ -184,6 +187,7 @@ namespace NavMeshTool const bool processInteriorCells = variables["process-interior-cells"].as(); const bool removeUnusedTiles = variables["remove-unused-tiles"].as(); const bool writeBinaryLog = variables["write-binary-log"].as(); + const bool collectStats = variables["collect-stats"].as(); const std::regex worldspaceFilter(variables["worldspace-filter"].as()); @@ -242,6 +246,7 @@ namespace NavMeshTool Status status = Status::Ok; bool needVacuum = false; std::size_t count = 0; + GenerateTilesStats stats; { SceneUtil::WorkQueue workQueue(threadsNumber); @@ -253,8 +258,14 @@ namespace NavMeshTool const WorldspaceData worldspaceData = gatherWorldspaceData(navigatorSettings, readers, vfs, bulletShapeManager, esmData, writeBinaryLog, worldspace, cells); - const Result result = generateAllNavMeshTiles(agentBounds, navigatorSettings, removeUnusedTiles, - writeBinaryLog, worldspaceData, db, workQueue); + const GenerateAllNavMeshTilesOptions generateAllNavMeshTilesOptions{ + .mRemoveUnusedTiles = removeUnusedTiles, + .mWriteBinaryLog = writeBinaryLog, + .mCollectStats = collectStats, + }; + + const GenerateTilesResult result = generateAllNavMeshTiles( + agentBounds, navigatorSettings, generateAllNavMeshTilesOptions, worldspaceData, db, workQueue); ++count; @@ -264,11 +275,23 @@ namespace NavMeshTool status = result.mStatus; needVacuum = needVacuum || result.mNeedVacuum; + if (collectStats) + { + stats.mMaxPolyCountPerTile + = std::max(stats.mMaxPolyCountPerTile, result.mStats.mMaxPolyCountPerTile); + } + if (status != Status::Ok) break; } } + if (collectStats) + { + Log(Debug::Info) << "Stats:"; + Log(Debug::Info) << "max polygons per tile = " << stats.mMaxPolyCountPerTile; + } + if (status == Status::Ok && needVacuum) { Log(Debug::Info) << "Vacuuming the database..."; diff --git a/apps/navmeshtool/navmesh.cpp b/apps/navmeshtool/navmesh.cpp index 3373620e46..04b1a58c86 100644 --- a/apps/navmeshtool/navmesh.cpp +++ b/apps/navmeshtool/navmesh.cpp @@ -36,6 +36,7 @@ namespace NavMeshTool using DetourNavigator::GenerateNavMeshTile; using DetourNavigator::MeshSource; using DetourNavigator::NavMeshDb; + using DetourNavigator::NavMeshTileConsumerStats; using DetourNavigator::NavMeshTileInfo; using DetourNavigator::PreparedNavMeshData; using DetourNavigator::RecastMesh; @@ -77,10 +78,11 @@ namespace NavMeshTool public: std::atomic_size_t mExpected{ 0 }; - explicit NavMeshTileConsumer(NavMeshDb& db, bool removeUnusedTiles, bool writeBinaryLog) + explicit NavMeshTileConsumer(NavMeshDb& db, const GenerateAllNavMeshTilesOptions& options) : mDb(db) - , mRemoveUnusedTiles(removeUnusedTiles) - , mWriteBinaryLog(writeBinaryLog) + , mRemoveUnusedTiles(options.mRemoveUnusedTiles) + , mWriteBinaryLog(options.mWriteBinaryLog) + , mCollectStats(options.mCollectStats) , mTransaction(mDb.startTransaction(Sqlite3::TransactionMode::Immediate)) , mNextTileId(mDb.getMaxTileId() + 1) , mNextShapeId(mDb.getMaxShapeId() + 1) @@ -99,6 +101,8 @@ namespace NavMeshTool return mDeleted; } + GenerateTilesStats getStats() const { return *mStats.lockConst(); } + std::int64_t resolveMeshSource(const MeshSource& source) override { const std::lock_guard lock(mMutex); @@ -110,12 +114,27 @@ namespace NavMeshTool { std::optional result; std::lock_guard lock(mMutex); - if (const auto tile = mDb.findTile(worldspace, tilePosition, input)) + if (mCollectStats) { - NavMeshTileInfo info; - info.mTileId = tile->mTileId; - info.mVersion = tile->mVersion; - result.emplace(info); + if (const auto tile = mDb.getTileData(worldspace, tilePosition, input)) + { + NavMeshTileInfo info; + info.mTileId = tile->mTileId; + info.mVersion = tile->mVersion; + info.mData = std::make_unique(); + deserialize(tile->mData, *info.mData); + result.emplace(std::move(info)); + } + } + else + { + if (const auto tile = mDb.findTile(worldspace, tilePosition, input)) + { + NavMeshTileInfo info; + info.mTileId = tile->mTileId; + info.mVersion = tile->mVersion; + result.emplace(std::move(info)); + } } return result; } @@ -184,6 +203,12 @@ namespace NavMeshTool mHasTile.notify_one(); } + void updateStats(const NavMeshTileConsumerStats& value) override + { + const Misc::Locked stats = mStats.lock(); + stats->mMaxPolyCountPerTile = std::max(stats->mMaxPolyCountPerTile, value.mPolyCount); + } + Status wait() { constexpr std::chrono::seconds transactionInterval(1); @@ -231,12 +256,14 @@ namespace NavMeshTool NavMeshDb& mDb; const bool mRemoveUnusedTiles; const bool mWriteBinaryLog; + const bool mCollectStats; Transaction mTransaction; TileId mNextTileId; std::condition_variable mHasTile; Misc::ProgressReporter mReporter; ShapeId mNextShapeId; std::mutex mReportMutex; + Misc::ScopeGuarded mStats; void report() { @@ -266,18 +293,19 @@ namespace NavMeshTool }; } - Result generateAllNavMeshTiles(const AgentBounds& agentBounds, const Settings& settings, bool removeUnusedTiles, - bool writeBinaryLog, const WorldspaceData& data, NavMeshDb& db, SceneUtil::WorkQueue& workQueue) + GenerateTilesResult generateAllNavMeshTiles(const AgentBounds& agentBounds, const Settings& settings, + const GenerateAllNavMeshTilesOptions& options, const WorldspaceData& data, NavMeshDb& db, + SceneUtil::WorkQueue& workQueue) { Log(Debug::Info) << "Generating navmesh tiles for " << data.mWorldspace << " worldspace..."; const std::shared_ptr navMeshTileConsumer - = std::make_shared(db, removeUnusedTiles, writeBinaryLog); + = std::make_shared(db, options); const TilesPositionsRange range = DetourNavigator::makeTilesPositionsRange( Misc::Convert::toOsgXY(data.mAabb.m_min), Misc::Convert::toOsgXY(data.mAabb.m_max), settings.mRecast); - if (removeUnusedTiles) + if (options.mRemoveUnusedTiles) navMeshTileConsumer->removeTilesOutsideRange(data.mWorldspace, range); std::vector worldspaceTiles = data.mTiles; @@ -285,7 +313,7 @@ namespace NavMeshTool { const std::size_t tiles = worldspaceTiles.size(); - if (writeBinaryLog) + if (options.mWriteBinaryLog) serializeToStderr(ExpectedTiles{ static_cast(tiles) }); navMeshTileConsumer->mExpected = tiles; @@ -300,8 +328,8 @@ namespace NavMeshTool = std::make_shared(data.mTilesData); for (const TilePosition& tilePosition : worldspaceTiles) - workQueue.addWorkItem(new GenerateNavMeshTile( - data.mWorldspace, tilePosition, recastMeshProvider, agentBounds, settings, navMeshTileConsumer)); + workQueue.addWorkItem(new GenerateNavMeshTile(data.mWorldspace, tilePosition, recastMeshProvider, + agentBounds, settings, options.mCollectStats, navMeshTileConsumer)); const Status status = navMeshTileConsumer->wait(); if (status == Status::Ok) @@ -314,9 +342,10 @@ namespace NavMeshTool Log(Debug::Info) << "Generated navmesh for " << navMeshTileConsumer->getProvided() << " tiles, " << inserted << " are inserted, " << updated << " updated and " << deleted << " deleted"; - return Result{ + return GenerateTilesResult{ .mStatus = status, .mNeedVacuum = inserted + updated + deleted > 0, + .mStats = navMeshTileConsumer->getStats(), }; } } diff --git a/apps/navmeshtool/navmesh.hpp b/apps/navmeshtool/navmesh.hpp index 2a0eed2fb0..7dfc4fffad 100644 --- a/apps/navmeshtool/navmesh.hpp +++ b/apps/navmeshtool/navmesh.hpp @@ -17,6 +17,13 @@ namespace NavMeshTool { struct WorldspaceData; + struct GenerateAllNavMeshTilesOptions + { + bool mRemoveUnusedTiles; + bool mWriteBinaryLog; + bool mCollectStats; + }; + enum class Status { Ok, @@ -24,14 +31,20 @@ namespace NavMeshTool NotEnoughSpace, }; - struct Result + struct GenerateTilesStats + { + int mMaxPolyCountPerTile = 0; + }; + + struct GenerateTilesResult { Status mStatus; bool mNeedVacuum; + GenerateTilesStats mStats; }; - Result generateAllNavMeshTiles(const DetourNavigator::AgentBounds& agentBounds, - const DetourNavigator::Settings& settings, bool removeUnusedTiles, bool writeBinaryLog, + GenerateTilesResult generateAllNavMeshTiles(const DetourNavigator::AgentBounds& agentBounds, + const DetourNavigator::Settings& settings, const GenerateAllNavMeshTilesOptions& options, const WorldspaceData& data, DetourNavigator::NavMeshDb& db, SceneUtil::WorkQueue& workQueue); } diff --git a/components/detournavigator/generatenavmeshtile.cpp b/components/detournavigator/generatenavmeshtile.cpp index 2351d7018f..6d507f2fba 100644 --- a/components/detournavigator/generatenavmeshtile.cpp +++ b/components/detournavigator/generatenavmeshtile.cpp @@ -2,12 +2,15 @@ #include "dbrefgeometryobject.hpp" #include "makenavmesh.hpp" +#include "navmeshdata.hpp" #include "preparednavmeshdata.hpp" #include "serialization.hpp" #include "settings.hpp" #include +#include + #include #include @@ -34,12 +37,13 @@ namespace DetourNavigator GenerateNavMeshTile::GenerateNavMeshTile(ESM::RefId worldspace, const TilePosition& tilePosition, std::weak_ptr recastMeshProvider, const AgentBounds& agentBounds, - const DetourNavigator::Settings& settings, std::weak_ptr consumer) + const DetourNavigator::Settings& settings, bool collectStats, std::weak_ptr consumer) : mWorldspace(worldspace) , mTilePosition(tilePosition) , mRecastMeshProvider(std::move(recastMeshProvider)) , mAgentBounds(agentBounds) , mSettings(settings) + , mCollectStats(collectStats) , mConsumer(std::move(consumer)) { } @@ -78,6 +82,18 @@ namespace DetourNavigator if (info.has_value() && info->mVersion == navMeshFormatVersion) { consumer->identity(mWorldspace, mTilePosition, info->mTileId); + + if (mCollectStats) + { + const NavMeshData tileData + = makeNavMeshTileData(*info->mData, {}, mAgentBounds, mTilePosition, mSettings.mRecast); + const dtMeshHeader& header = *reinterpret_cast(tileData.mValue.get()); + + consumer->updateStats(NavMeshTileConsumerStats{ + .mPolyCount = header.polyCount, + }); + } + ignore.mConsumer = nullptr; return; } @@ -88,11 +104,23 @@ namespace DetourNavigator if (data == nullptr) return; + // Verify generated data before consuming. + const NavMeshData tileData = makeNavMeshTileData(*data, {}, mAgentBounds, mTilePosition, mSettings.mRecast); + if (info.has_value()) consumer->update(mWorldspace, mTilePosition, info->mTileId, navMeshFormatVersion, *data); else consumer->insert(mWorldspace, mTilePosition, navMeshFormatVersion, input, *data); + if (mCollectStats) + { + const dtMeshHeader& header = *reinterpret_cast(tileData.mValue.get()); + + consumer->updateStats(NavMeshTileConsumerStats{ + .mPolyCount = header.polyCount, + }); + } + ignore.mConsumer = nullptr; } catch (const std::exception& e) diff --git a/components/detournavigator/generatenavmeshtile.hpp b/components/detournavigator/generatenavmeshtile.hpp index 3c0a3e2339..e7f61beb98 100644 --- a/components/detournavigator/generatenavmeshtile.hpp +++ b/components/detournavigator/generatenavmeshtile.hpp @@ -2,6 +2,7 @@ #define OPENMW_COMPONENTS_DETOURNAVIGATOR_GENERATENAVMESHTILE_H #include "agentbounds.hpp" +#include "preparednavmeshdata.hpp" #include "recastmeshprovider.hpp" #include "tileposition.hpp" @@ -19,7 +20,6 @@ namespace DetourNavigator class RecastMesh; struct NavMeshTileConsumer; struct OffMeshConnection; - struct PreparedNavMeshData; struct Settings; struct MeshSource; @@ -27,6 +27,12 @@ namespace DetourNavigator { std::int64_t mTileId; std::int64_t mVersion; + std::unique_ptr mData; + }; + + struct NavMeshTileConsumerStats + { + int mPolyCount; }; struct NavMeshTileConsumer @@ -52,6 +58,8 @@ namespace DetourNavigator = 0; virtual void cancel(std::string_view reason) = 0; + + virtual void updateStats(const NavMeshTileConsumerStats& value) = 0; }; class GenerateNavMeshTile final : public SceneUtil::WorkItem @@ -59,7 +67,7 @@ namespace DetourNavigator public: GenerateNavMeshTile(ESM::RefId worldspace, const TilePosition& tilePosition, std::weak_ptr recastMeshProvider, const AgentBounds& agentBounds, - const Settings& settings, std::weak_ptr consumer); + const Settings& settings, bool collectStats, std::weak_ptr consumer); void doWork() final; @@ -69,6 +77,7 @@ namespace DetourNavigator const std::weak_ptr mRecastMeshProvider; const AgentBounds mAgentBounds; const Settings& mSettings; + const bool mCollectStats; const std::weak_ptr mConsumer; inline void impl() noexcept; From beb256d822b649a0ff140bcf8909f49cee3de448 Mon Sep 17 00:00:00 2001 From: elsid Date: Wed, 1 Apr 2026 14:58:50 -0700 Subject: [PATCH 3/6] Remove redundant local variable --- components/detournavigator/makenavmesh.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/components/detournavigator/makenavmesh.cpp b/components/detournavigator/makenavmesh.cpp index ef875cce0d..4a650955a2 100644 --- a/components/detournavigator/makenavmesh.cpp +++ b/components/detournavigator/makenavmesh.cpp @@ -594,9 +594,8 @@ namespace DetourNavigator unsigned char* navMeshData; int navMeshDataSize; - const auto navMeshDataCreated = dtCreateNavMeshData(¶ms, &navMeshData, &navMeshDataSize); - if (!navMeshDataCreated) + if (!dtCreateNavMeshData(¶ms, &navMeshData, &navMeshDataSize)) throw NavigatorException("Failed to create navmesh tile data"); return NavMeshData(navMeshData, navMeshDataSize); From 483210dfb292c233c3e957ef923f528cae7091f1 Mon Sep 17 00:00:00 2001 From: elsid Date: Thu, 2 Apr 2026 10:43:49 -0700 Subject: [PATCH 4/6] Print total number of changed tiles for all processed worldspaces --- apps/navmeshtool/main.cpp | 15 ++++++++++++--- apps/navmeshtool/navmesh.cpp | 16 ++++++++++------ apps/navmeshtool/navmesh.hpp | 7 ++++++- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/apps/navmeshtool/main.cpp b/apps/navmeshtool/main.cpp index 3f2bd7eded..440ca8b325 100644 --- a/apps/navmeshtool/main.cpp +++ b/apps/navmeshtool/main.cpp @@ -244,7 +244,10 @@ namespace NavMeshTool = collectWorldspaceCells(esmData, processInteriorCells, worldspaceFilter); Status status = Status::Ok; - bool needVacuum = false; + std::size_t provided = 0; + std::size_t inserted = 0; + std::size_t updated = 0; + std::size_t deleted = 0; std::size_t count = 0; GenerateTilesStats stats; @@ -273,7 +276,10 @@ namespace NavMeshTool << worldspace; status = result.mStatus; - needVacuum = needVacuum || result.mNeedVacuum; + provided += result.mProvided; + inserted += result.mInserted; + updated += result.mUpdated; + deleted += result.mDeleted; if (collectStats) { @@ -286,13 +292,16 @@ namespace NavMeshTool } } + Log(Debug::Info) << "Generated navmesh for " << provided << " tiles: " << inserted << " inserted, " + << updated << " updated, " << deleted << " deleted"; + if (collectStats) { Log(Debug::Info) << "Stats:"; Log(Debug::Info) << "max polygons per tile = " << stats.mMaxPolyCountPerTile; } - if (status == Status::Ok && needVacuum) + if (status == Status::Ok && inserted + updated + deleted > 0) { Log(Debug::Info) << "Vacuuming the database..."; db.vacuum(); diff --git a/apps/navmeshtool/navmesh.cpp b/apps/navmeshtool/navmesh.cpp index 04b1a58c86..527b1bba97 100644 --- a/apps/navmeshtool/navmesh.cpp +++ b/apps/navmeshtool/navmesh.cpp @@ -335,16 +335,20 @@ namespace NavMeshTool if (status == Status::Ok) navMeshTileConsumer->commit(); - const auto inserted = navMeshTileConsumer->getInserted(); - const auto updated = navMeshTileConsumer->getUpdated(); - const auto deleted = navMeshTileConsumer->getDeleted(); + const std::size_t provided = navMeshTileConsumer->getProvided(); + const std::size_t inserted = navMeshTileConsumer->getInserted(); + const std::size_t updated = navMeshTileConsumer->getUpdated(); + const std::size_t deleted = navMeshTileConsumer->getDeleted(); - Log(Debug::Info) << "Generated navmesh for " << navMeshTileConsumer->getProvided() << " tiles, " << inserted - << " are inserted, " << updated << " updated and " << deleted << " deleted"; + Log(Debug::Info) << "Generated navmesh for " << provided << " tiles: " << inserted << " inserted, " << updated + << " updated, " << deleted << " deleted"; return GenerateTilesResult{ .mStatus = status, - .mNeedVacuum = inserted + updated + deleted > 0, + .mProvided = provided, + .mInserted = inserted, + .mUpdated = updated, + .mDeleted = deleted, .mStats = navMeshTileConsumer->getStats(), }; } diff --git a/apps/navmeshtool/navmesh.hpp b/apps/navmeshtool/navmesh.hpp index 7dfc4fffad..f0d08a7110 100644 --- a/apps/navmeshtool/navmesh.hpp +++ b/apps/navmeshtool/navmesh.hpp @@ -1,6 +1,8 @@ #ifndef OPENMW_NAVMESHTOOL_NAVMESH_H #define OPENMW_NAVMESHTOOL_NAVMESH_H +#include + namespace DetourNavigator { class NavMeshDb; @@ -39,7 +41,10 @@ namespace NavMeshTool struct GenerateTilesResult { Status mStatus; - bool mNeedVacuum; + std::size_t mProvided; + std::size_t mInserted; + std::size_t mUpdated; + std::size_t mDeleted; GenerateTilesStats mStats; }; From 8a6b07f230a56ba96a24674f34ce94def946b5c8 Mon Sep 17 00:00:00 2001 From: elsid Date: Thu, 2 Apr 2026 10:15:33 -0700 Subject: [PATCH 5/6] Skip progress reporting on no navmesh tiles to generate --- apps/navmeshtool/navmesh.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/apps/navmeshtool/navmesh.cpp b/apps/navmeshtool/navmesh.cpp index 527b1bba97..1323aa77b8 100644 --- a/apps/navmeshtool/navmesh.cpp +++ b/apps/navmeshtool/navmesh.cpp @@ -211,6 +211,8 @@ namespace NavMeshTool Status wait() { + if (mExpected == 0) + return Status::Ok; constexpr std::chrono::seconds transactionInterval(1); std::unique_lock lock(mMutex); auto start = std::chrono::steady_clock::now(); From 00252a6e4d3ba08f0ea88312d5bce517f86d7f4a Mon Sep 17 00:00:00 2001 From: elsid Date: Thu, 2 Apr 2026 11:00:05 -0700 Subject: [PATCH 6/6] Warn about changed max tiles number --- components/detournavigator/settings.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/components/detournavigator/settings.cpp b/components/detournavigator/settings.cpp index d71b3d12bc..e3dfead77d 100644 --- a/components/detournavigator/settings.cpp +++ b/components/detournavigator/settings.cpp @@ -107,6 +107,11 @@ namespace DetourNavigator result.mWriteToNavMeshDb = ::Settings::navigator().mWriteToNavmeshdb; result.mMaxDbFileSize = ::Settings::navigator().mMaxNavmeshdbFileSize; + if (result.mMaxTilesNumber < ::Settings::navigator().mMaxTilesNumber.get()) + Log(Debug::Warning) + << "Navigator max tiles number is adjusted due to limitation on number of bits for tile identifier: " + << result.mMaxTilesNumber; + return result; } }