fixed made by @ZehMatt in 6abb96250f and cdcf1393fc

crashfix_debugdraw
florent.teppe 2 years ago
parent 9092c32f2e
commit 57df51b4a6

@ -233,17 +233,14 @@ namespace MWWorld
template <class T>
static const T *esm3insertStatic(ESMStore& stores, const T &x)
{
const std::string id = "$dynamic" + std::to_string(stores.mDynamicCount++);
Store<T> &store = stores.getWritable<T>();
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);
auto esm3RecordType_find = stores.mStoreImp->mStoreToRecName.find(&stores.get<T>());
if (esm3RecordType_find != stores.mStoreImp->mStoreToRecName.end())
{
@ -769,13 +766,14 @@ void ESMStore::removeMissingObjects(Store<T>& store)
template <>
const ESM::NPC *ESMStore::insert<ESM::NPC>(const ESM::NPC &npc)
{
const std::string id = "$dynamic" + std::to_string(mDynamicCount++);
auto& npcs = getWritable<ESM::NPC>();
if (Misc::StringUtils::ciEqual(npc.mId, "player"))
{
return npcs.insert(npc);
}
else if (npcs.search(id) != nullptr)
const std::string id = "$dynamic" + std::to_string(mDynamicCount++);
if (npcs.search(id) != nullptr)
{
const std::string msg = "Try to override existing record '" + id + "'";
throw std::runtime_error(msg);

Loading…
Cancel
Save