From 3258fa4f98e3fdf2c3cd5a2d53afa2e2eefdc2fe Mon Sep 17 00:00:00 2001 From: "florent.teppe" Date: Sun, 2 Apr 2023 22:11:19 +0200 Subject: [PATCH] setworldspace uses serializeText --- apps/navmeshtool/worldspacedata.cpp | 13 +++++++------ apps/openmw/mwworld/scene.cpp | 12 ++++++------ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/apps/navmeshtool/worldspacedata.cpp b/apps/navmeshtool/worldspacedata.cpp index 3de8d2395f..12c8c050a2 100644 --- a/apps/navmeshtool/worldspacedata.cpp +++ b/apps/navmeshtool/worldspacedata.cpp @@ -263,17 +263,18 @@ namespace NavMeshTool const osg::Vec2i cellPosition(cell.mData.mX, cell.mData.mY); const std::size_t cellObjectsBegin = data.mObjects.size(); - const auto cellNameLowerCase - = Misc::StringUtils::lowerCase(cell.isExterior() ? ESM::Cell::sDefaultWorldspace : cell.mName); + const auto cellWorldspace = Misc::StringUtils::lowerCase( + (cell.isExterior() ? ESM::RefId::stringRefId(ESM::Cell::sDefaultWorldspace) : cell.mId) + .serializeText()); WorldspaceNavMeshInput& navMeshInput = [&]() -> WorldspaceNavMeshInput& { - auto it = navMeshInputs.find(cellNameLowerCase); + auto it = navMeshInputs.find(cellWorldspace); if (it == navMeshInputs.end()) { it = navMeshInputs - .emplace(cellNameLowerCase, - std::make_unique(cellNameLowerCase, settings.mRecast)) + .emplace(cellWorldspace, + std::make_unique(cellWorldspace, settings.mRecast)) .first; - it->second->mTileCachedRecastMeshManager.setWorldspace(cellNameLowerCase, nullptr); + it->second->mTileCachedRecastMeshManager.setWorldspace(cellWorldspace, nullptr); } return *it->second; }(); diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index 313b0ed8f9..92cbd468e9 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -556,7 +556,7 @@ namespace MWWorld .getExterior(playerCellX, playerCellY) ->getCell() ->getWorldSpace() - .getRefIdString()), + .serializeText()), navigatorUpdateGuard.get()); mNavigator.updateBounds(pos, navigatorUpdateGuard.get()); @@ -677,8 +677,8 @@ namespace MWWorld "Testing exterior cells (" + std::to_string(i) + "/" + std::to_string(cells.getExtSize()) + ")..."); CellStore* cell = mWorld.getWorldModel().getExterior(it->mData.mX, it->mData.mY); - mNavigator.setWorldspace( - Misc::StringUtils::lowerCase(cell->getCell()->getWorldSpace().toString()), navigatorUpdateGuard.get()); + mNavigator.setWorldspace(Misc::StringUtils::lowerCase(cell->getCell()->getWorldSpace().serializeText()), + navigatorUpdateGuard.get()); const osg::Vec3f position = osg::Vec3f(it->mData.mX + 0.5f, it->mData.mY + 0.5f, 0) * Constants::CellSizeInUnits; mNavigator.updateBounds(position, navigatorUpdateGuard.get()); @@ -735,8 +735,8 @@ namespace MWWorld "Testing interior cells (" + std::to_string(i) + "/" + std::to_string(cells.getIntSize()) + ")..."); CellStore* cell = mWorld.getWorldModel().getInterior(it->mName); - mNavigator.setWorldspace( - Misc::StringUtils::lowerCase(cell->getCell()->getWorldSpace().toString()), navigatorUpdateGuard.get()); + mNavigator.setWorldspace(Misc::StringUtils::lowerCase(cell->getCell()->getWorldSpace().serializeText()), + navigatorUpdateGuard.get()); ESM::Position position; mWorld.findInteriorPosition(it->mName, position); mNavigator.updateBounds(position.asVec3(), navigatorUpdateGuard.get()); @@ -892,7 +892,7 @@ namespace MWWorld loadingListener->setProgressRange(cell->count()); mNavigator.setWorldspace( - Misc::StringUtils::lowerCase(cell->getCell()->getWorldSpace().toString()), navigatorUpdateGuard.get()); + Misc::StringUtils::lowerCase(cell->getCell()->getWorldSpace().serializeText()), navigatorUpdateGuard.get()); mNavigator.updateBounds(position.asVec3(), navigatorUpdateGuard.get()); // Load cell.