mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-01 03:21:41 +00:00
Use ESM::RefId as key for Globals::mVariables
This commit is contained in:
parent
cd6a5b5a0e
commit
3975003778
@ -37,7 +37,7 @@ namespace MWWorld
|
||||
|
||||
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.
|
||||
global.load(reader, isDeleted);
|
||||
|
||||
Collection::iterator iter = mVariables.find(global.mId.getRefIdString());
|
||||
if (iter != mVariables.end())
|
||||
if (const auto iter = mVariables.find(global.mId); iter != mVariables.end())
|
||||
iter->second = global;
|
||||
|
||||
return true;
|
||||
|
@ -2,8 +2,8 @@
|
||||
#define GAME_MWWORLD_GLOBALS_H
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
#include <components/esm3/loadglob.hpp>
|
||||
@ -29,8 +29,7 @@ namespace MWWorld
|
||||
class Globals
|
||||
{
|
||||
private:
|
||||
using Collection
|
||||
= std::unordered_map<std::string, ESM::Global, Misc::StringUtils::CiHash, Misc::StringUtils::CiEqual>;
|
||||
using Collection = std::map<ESM::RefId, ESM::Global, std::less<>>;
|
||||
|
||||
Collection mVariables; // type, value
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user