1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 15:29:55 +00:00

Fix increment of dynamic id when player is inserted

This commit is contained in:
ζeh Matt 2022-08-15 17:06:01 +03:00
parent 6abb96250f
commit cdcf1393fc
No known key found for this signature in database
GPG key ID: 18CE582C71A225B0

View file

@ -296,13 +296,13 @@ namespace MWWorld
template <>
inline const ESM::NPC *ESMStore::insert<ESM::NPC>(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);