mirror of
https://github.com/OpenMW/openmw.git
synced 2025-04-18 08:06:46 +00:00
Fix using the wrong id for insertStatic
This commit is contained in:
parent
6756f4397e
commit
6abb96250f
1 changed files with 3 additions and 6 deletions
|
@ -249,17 +249,14 @@ namespace MWWorld
|
||||||
template <class T>
|
template <class T>
|
||||||
const T *insertStatic(const T &x)
|
const T *insertStatic(const T &x)
|
||||||
{
|
{
|
||||||
const std::string id = "$dynamic" + std::to_string(mDynamicCount++);
|
|
||||||
|
|
||||||
Store<T> &store = const_cast<Store<T> &>(get<T>());
|
Store<T> &store = const_cast<Store<T> &>(get<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);
|
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) {
|
for (iterator it = mStores.begin(); it != mStores.end(); ++it) {
|
||||||
if (it->second == &store) {
|
if (it->second == &store) {
|
||||||
mIds[ptr->mId] = it->first;
|
mIds[ptr->mId] = it->first;
|
||||||
|
|
Loading…
Reference in a new issue