mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-20 17:11:33 +00:00
Use ESM::RefId as key for Globals::mVariables
This commit is contained in:
parent
cd6a5b5a0e
commit
3975003778
2 changed files with 4 additions and 6 deletions
|
@ -37,7 +37,7 @@ namespace MWWorld
|
||||||
|
|
||||||
for (const ESM::Global& esmGlobal : globals)
|
for (const ESM::Global& esmGlobal : globals)
|
||||||
{
|
{
|
||||||
mVariables.emplace(esmGlobal.mId.getRefIdString(), esmGlobal);
|
mVariables.emplace(esmGlobal.mId, esmGlobal);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,8 +98,7 @@ namespace MWWorld
|
||||||
// Deleted globals can't appear there, so isDeleted will be ignored here.
|
// Deleted globals can't appear there, so isDeleted will be ignored here.
|
||||||
global.load(reader, isDeleted);
|
global.load(reader, isDeleted);
|
||||||
|
|
||||||
Collection::iterator iter = mVariables.find(global.mId.getRefIdString());
|
if (const auto iter = mVariables.find(global.mId); iter != mVariables.end())
|
||||||
if (iter != mVariables.end())
|
|
||||||
iter->second = global;
|
iter->second = global;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
#define GAME_MWWORLD_GLOBALS_H
|
#define GAME_MWWORLD_GLOBALS_H
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
#include <map>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <unordered_map>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <components/esm3/loadglob.hpp>
|
#include <components/esm3/loadglob.hpp>
|
||||||
|
@ -29,8 +29,7 @@ namespace MWWorld
|
||||||
class Globals
|
class Globals
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
using Collection
|
using Collection = std::map<ESM::RefId, ESM::Global, std::less<>>;
|
||||||
= std::unordered_map<std::string, ESM::Global, Misc::StringUtils::CiHash, Misc::StringUtils::CiEqual>;
|
|
||||||
|
|
||||||
Collection mVariables; // type, value
|
Collection mVariables; // type, value
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue