1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2026-01-13 07:30:56 +00:00
openmw/components/esm3/actoridconverter.cpp

32 lines
713 B
C++

#include "actoridconverter.hpp"
namespace ESM
{
void ActorIdConverter::apply()
{
for (auto& [refNum, actorId] : mToConvert)
{
auto it = mMappings.find(actorId);
if (it == mMappings.end())
refNum = {};
else
refNum = it->second;
}
}
void ActorIdConverter::convert(ESM::RefNum& refNum, int actorId)
{
if (actorId == -1)
{
refNum = {};
return;
}
auto it = mMappings.find(actorId);
if (it == mMappings.end())
{
mToConvert.emplace_back(refNum, actorId);
return;
}
refNum = it->second;
}
}