From 64c24800c62bfebec9cb1ab6c691e2e40c639364 Mon Sep 17 00:00:00 2001 From: elsid Date: Thu, 25 Dec 2025 13:04:45 +0100 Subject: [PATCH 1/3] Simplify initialization --- components/esm3/loadcell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esm3/loadcell.cpp b/components/esm3/loadcell.cpp index b1efea1aec..f917c594f2 100644 --- a/components/esm3/loadcell.cpp +++ b/components/esm3/loadcell.cpp @@ -40,7 +40,7 @@ namespace ESM namespace ESM { - const StringRefId Cell::sDefaultWorldspaceId = StringRefId("sys::default"); + const StringRefId Cell::sDefaultWorldspaceId("sys::default"); template T> void decompose(T&& v, const auto& f) From fc297f741a16f6ec388c0709f96a843587a7cad6 Mon Sep 17 00:00:00 2001 From: elsid Date: Thu, 25 Dec 2025 13:05:16 +0100 Subject: [PATCH 2/3] Remove redundant includes --- components/esm/refid.cpp | 3 --- components/esm/stringrefid.cpp | 3 --- components/esm/stringrefid.hpp | 1 - 3 files changed, 7 deletions(-) diff --git a/components/esm/refid.cpp b/components/esm/refid.cpp index 89df886974..6ccb335b58 100644 --- a/components/esm/refid.cpp +++ b/components/esm/refid.cpp @@ -4,11 +4,8 @@ #include "components/misc/strings/lower.hpp" -#include -#include #include #include -#include #include namespace ESM diff --git a/components/esm/stringrefid.cpp b/components/esm/stringrefid.cpp index 2f9a8fd6b3..820a61df34 100644 --- a/components/esm/stringrefid.cpp +++ b/components/esm/stringrefid.cpp @@ -2,10 +2,7 @@ #include "serializerefid.hpp" #include -#include -#include #include -#include #include #include diff --git a/components/esm/stringrefid.hpp b/components/esm/stringrefid.hpp index ec8e898bc7..29c24585ae 100644 --- a/components/esm/stringrefid.hpp +++ b/components/esm/stringrefid.hpp @@ -6,7 +6,6 @@ #include #include #include -#include #include From 07621574d08953d2cd1cf870b1c785ca2689c576 Mon Sep 17 00:00:00 2001 From: elsid Date: Thu, 25 Dec 2025 13:19:53 +0100 Subject: [PATCH 3/3] Report number of StringRefIds --- apps/openmw/engine.cpp | 2 ++ components/esm/stringrefid.cpp | 5 +++++ components/esm/stringrefid.hpp | 2 ++ components/resource/stats.cpp | 2 +- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 66bd16ea3e..8d8a0bc7b9 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -333,6 +333,8 @@ bool OMW::Engine::frame(unsigned frameNumber, float frametime) mMechanicsManager->reportStats(frameNumber, *stats); mWorld->reportStats(frameNumber, *stats); mLuaManager->reportStats(frameNumber, *stats); + + stats->setAttribute(frameNumber, "StringRefId Count", static_cast(ESM::StringRefId::totalCount())); } mStereoManager->updateSettings(Settings::camera().mNearClip, Settings::camera().mViewingDistance); diff --git a/components/esm/stringrefid.cpp b/components/esm/stringrefid.cpp index 820a61df34..8c4c285239 100644 --- a/components/esm/stringrefid.cpp +++ b/components/esm/stringrefid.cpp @@ -142,4 +142,9 @@ namespace ESM id.mValue = &*it; return id; } + + std::size_t StringRefId::totalCount() + { + return getRefIds().lock()->size(); + } } diff --git a/components/esm/stringrefid.hpp b/components/esm/stringrefid.hpp index 29c24585ae..28682c655f 100644 --- a/components/esm/stringrefid.hpp +++ b/components/esm/stringrefid.hpp @@ -49,6 +49,8 @@ namespace ESM // Similar to the constructor but only returns preexisting ids static std::optional deserializeExisting(std::string_view value); + static std::size_t totalCount(); + private: Misc::NotNullPtr mValue; }; diff --git a/components/resource/stats.cpp b/components/resource/stats.cpp index d3bb721584..e0c4c0be63 100644 --- a/components/resource/stats.cpp +++ b/components/resource/stats.cpp @@ -74,7 +74,7 @@ namespace Resource "", "Lua UsedMemory", "", - "", + "StringRefId Count", "", };