mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-28 22:39:42 +00:00
restores ESM::Dialogue order (#3209)
With this PR we restore the previous order of `ESM::Dialogue` entries implicitly changed by PR #3197. In the future we may want to consider additional verification and documentation of `mShared` order inconsistencies. We might additionally consider applying this sorting in the particular code that requires it.
This commit is contained in:
parent
c9f3c27dc7
commit
fac84b5dd3
2 changed files with 10 additions and 4 deletions
|
@ -1005,6 +1005,9 @@ namespace MWWorld
|
|||
mShared.reserve(mStatic.size());
|
||||
for (auto & [_, dial] : mStatic)
|
||||
mShared.push_back(&dial);
|
||||
// TODO: verify and document this inconsistent behaviour
|
||||
// TODO: if we require this behaviour, maybe we should move it to the place that requires it
|
||||
std::sort(mShared.begin(), mShared.end(), [](const ESM::Dialogue* l, const ESM::Dialogue* r) -> bool { return l->mId < r->mId; });
|
||||
}
|
||||
|
||||
template <>
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
#include <unordered_map>
|
||||
#include <set>
|
||||
|
||||
#include "recordcmp.hpp"
|
||||
#include <components/esm/records.hpp>
|
||||
#include <components/misc/stringops.hpp>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
|
@ -150,9 +151,11 @@ namespace MWWorld
|
|||
{
|
||||
typedef std::unordered_map<std::string, T, Misc::StringUtils::CiHash, Misc::StringUtils::CiEqual> Static;
|
||||
Static mStatic;
|
||||
std::vector<T*> mShared; // Preserves the record order as it came from the content files (this
|
||||
// is relevant for the spell autocalc code and selection order
|
||||
// for heads/hairs in the character creation)
|
||||
/// @par mShared usually preserves the record order as it came from the content files (this
|
||||
/// is relevant for the spell autocalc code and selection order
|
||||
/// for heads/hairs in the character creation)
|
||||
/// @warning ESM::Dialogue Store currently implements a sorted order for unknown reasons.
|
||||
std::vector<T*> mShared;
|
||||
typedef std::unordered_map<std::string, T, Misc::StringUtils::CiHash, Misc::StringUtils::CiEqual> Dynamic;
|
||||
Dynamic mDynamic;
|
||||
|
||||
|
|
Loading…
Reference in a new issue