mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
Fix for NPC store clearDynamic bug
It was clearing the whole mShared vector, instead of only the dynamic part. Actually, that whole overload was pointless to begin with. All it does is making sure the Player record isn't cleared, but ESMStore::clearDynamic re-inserts the player record anyway after clearing.
This commit is contained in:
parent
d31ae2b345
commit
2ddbe22da3
1 changed files with 6 additions and 17 deletions
|
@ -140,7 +140,8 @@ namespace MWWorld
|
||||||
virtual void clearDynamic()
|
virtual void clearDynamic()
|
||||||
{
|
{
|
||||||
// remove the dynamic part of mShared
|
// remove the dynamic part of mShared
|
||||||
mShared.erase(mShared.begin() + mStatic.size(), mShared.end());
|
if (mShared.size() > mStatic.size())
|
||||||
|
mShared.erase(mShared.begin() + mStatic.size(), mShared.end());
|
||||||
mDynamic.clear();
|
mDynamic.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,7 +218,8 @@ namespace MWWorld
|
||||||
|
|
||||||
void setUp() {
|
void setUp() {
|
||||||
// remove the dynamic part of mShared
|
// remove the dynamic part of mShared
|
||||||
mShared.erase(mShared.begin() + mStatic.size(), mShared.end());
|
if (mShared.size() > mStatic.size())
|
||||||
|
mShared.erase(mShared.begin() + mStatic.size(), mShared.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
iterator begin() const {
|
iterator begin() const {
|
||||||
|
@ -305,7 +307,8 @@ namespace MWWorld
|
||||||
mDynamic.erase(it);
|
mDynamic.erase(it);
|
||||||
|
|
||||||
// have to reinit the whole shared part
|
// have to reinit the whole shared part
|
||||||
mShared.erase(mShared.begin() + mStatic.size(), mShared.end());
|
if (mShared.size() > mStatic.size())
|
||||||
|
mShared.erase(mShared.begin() + mStatic.size(), mShared.end());
|
||||||
for (it = mDynamic.begin(); it != mDynamic.end(); ++it) {
|
for (it = mDynamic.begin(); it != mDynamic.end(); ++it) {
|
||||||
mShared.push_back(&it->second);
|
mShared.push_back(&it->second);
|
||||||
}
|
}
|
||||||
|
@ -338,20 +341,6 @@ namespace MWWorld
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
|
||||||
inline void Store<ESM::NPC>::clearDynamic()
|
|
||||||
{
|
|
||||||
std::map<std::string, ESM::NPC>::iterator iter = mDynamic.begin();
|
|
||||||
|
|
||||||
while (iter!=mDynamic.end())
|
|
||||||
if (iter->first=="player")
|
|
||||||
++iter;
|
|
||||||
else
|
|
||||||
mDynamic.erase (iter++);
|
|
||||||
|
|
||||||
mShared.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline void Store<ESM::Dialogue>::load(ESM::ESMReader &esm, const std::string &id) {
|
inline void Store<ESM::Dialogue>::load(ESM::ESMReader &esm, const std::string &id) {
|
||||||
std::string idLower = Misc::StringUtils::lowerCase(id);
|
std::string idLower = Misc::StringUtils::lowerCase(id);
|
||||||
|
|
Loading…
Reference in a new issue