From 6abb96250fb750a71cf05e7684ac6abf0a22c75d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <3397065-ZehMatt@users.noreply.gitlab.com> Date: Mon, 15 Aug 2022 17:04:37 +0300 Subject: [PATCH] Fix using the wrong id for insertStatic --- apps/openmw/mwworld/esmstore.hpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/apps/openmw/mwworld/esmstore.hpp b/apps/openmw/mwworld/esmstore.hpp index 0c03585e1f..6829101f66 100644 --- a/apps/openmw/mwworld/esmstore.hpp +++ b/apps/openmw/mwworld/esmstore.hpp @@ -249,17 +249,14 @@ namespace MWWorld template const T *insertStatic(const T &x) { - const std::string id = "$dynamic" + std::to_string(mDynamicCount++); - Store &store = const_cast &>(get()); - if (store.search(id) != nullptr) + if (store.search(x.mId) != nullptr) { - const std::string msg = "Try to override existing record '" + id + "'"; + const std::string msg = "Try to override existing record '" + x.mId + "'"; throw std::runtime_error(msg); } - T record = x; - T *ptr = store.insertStatic(record); + T *ptr = store.insertStatic(x); for (iterator it = mStores.begin(); it != mStores.end(); ++it) { if (it->second == &store) { mIds[ptr->mId] = it->first;