From cdcf1393fcab8521644feede483316f3b3d352b0 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:06:01 +0300 Subject: [PATCH] Fix increment of dynamic id when player is inserted --- apps/openmw/mwworld/esmstore.hpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwworld/esmstore.hpp b/apps/openmw/mwworld/esmstore.hpp index 6829101f66..b4df837936 100644 --- a/apps/openmw/mwworld/esmstore.hpp +++ b/apps/openmw/mwworld/esmstore.hpp @@ -296,13 +296,13 @@ namespace MWWorld template <> inline const ESM::NPC *ESMStore::insert(const ESM::NPC &npc) { - const std::string id = "$dynamic" + std::to_string(mDynamicCount++); - if (Misc::StringUtils::ciEqual(npc.mId, "player")) { return mNpcs.insert(npc); } - else if (mNpcs.search(id) != nullptr) + + const std::string id = "$dynamic" + std::to_string(mDynamicCount++); + if (mNpcs.search(id) != nullptr) { const std::string msg = "Try to override existing record '" + id + "'"; throw std::runtime_error(msg);