Replace `const ESM::RefNum&` -> `ESM::RefNum`

macos_ci_fix
Petr Mikheev 1 year ago
parent 551f424c80
commit c67b866a11

@ -103,8 +103,7 @@ namespace NavMeshTool
Log(Debug::Debug) << "Loaded " << cellRefs.size() << " cell refs";
const auto getKey
= [](const EsmLoader::Record<CellRef>& v) -> const ESM::RefNum& { return v.mValue.mRefNum; };
const auto getKey = [](const EsmLoader::Record<CellRef>& v) -> ESM::RefNum { return v.mValue.mRefNum; };
std::vector<CellRef> result = prepareRecords(cellRefs, getKey);
Log(Debug::Debug) << "Prepared " << result.size() << " unique cell refs";

@ -87,7 +87,7 @@ namespace MWLua
void operator()(const OnNewExterior& event) const { mGlobalScripts.onNewExterior(GCell{ &event.mCell }); }
private:
MWWorld::Ptr getPtr(const ESM::RefNum& id) const
MWWorld::Ptr getPtr(ESM::RefNum id) const
{
MWWorld::Ptr res = mWorldModel->getPtr(id);
if (res.isEmpty() && Settings::lua().mLuaDebug)
@ -103,7 +103,7 @@ namespace MWLua
return ptr.getRefData().getLuaScripts();
}
LocalScripts* getLocalScripts(const ESM::RefNum& id) const { return getLocalScripts(getPtr(id)); }
LocalScripts* getLocalScripts(ESM::RefNum id) const { return getLocalScripts(getPtr(id)); }
GlobalScripts& mGlobalScripts;
MWWorld::WorldModel* mWorldModel = MWBase::Environment::get().getWorldModel();

@ -52,7 +52,7 @@ namespace MWLua
}
template <typename Event>
static void saveEvent(ESM::ESMWriter& esm, const ESM::RefNum& dest, const Event& event)
static void saveEvent(ESM::ESMWriter& esm, ESM::RefNum dest, const Event& event)
{
esm.writeHNString("LUAE", event.mEventName);
esm.writeFormId(dest, true);

@ -16,7 +16,7 @@ namespace MWLua
// ObjectId is a unique identifier of a game object.
// It can change only if the order of content files was change.
using ObjectId = ESM::RefNum;
inline const ObjectId& getId(const MWWorld::Ptr& ptr)
inline ObjectId getId(const MWWorld::Ptr& ptr)
{
return ptr.getCellRef().getRefNum();
}

@ -75,7 +75,7 @@ namespace MWLua
if (mChanged)
{
mList->clear();
for (const ObjectId& id : mSet)
for (ObjectId id : mSet)
mList->push_back(id);
mChanged = false;
}

@ -52,7 +52,7 @@ namespace MWLua
{
std::vector<ESM::RefNum> buf;
buf.reserve(objList->size());
for (const ESM::RefNum& v : *objList)
for (ESM::RefNum v : *objList)
buf.push_back({ Misc::toLittleEndian(v.mIndex), Misc::toLittleEndian(v.mContentFile) });
append(out, sObjListTypeName, buf.data(), buf.size() * sizeof(ESM::RefNum));
}

@ -437,7 +437,7 @@ namespace MWRender
class AddRefnumMarkerVisitor : public osg::NodeVisitor
{
public:
AddRefnumMarkerVisitor(const ESM::RefNum& refnum)
AddRefnumMarkerVisitor(ESM::RefNum refnum)
: osg::NodeVisitor(TRAVERSE_ALL_CHILDREN)
, mRefnum(refnum)
{
@ -896,7 +896,7 @@ namespace MWRender
};
bool ObjectPaging::enableObject(
int type, const ESM::RefNum& refnum, const osg::Vec3f& pos, const osg::Vec2i& cell, bool enabled)
int type, ESM::RefNum refnum, const osg::Vec3f& pos, const osg::Vec2i& cell, bool enabled)
{
if (!typeFilter(type, false))
return false;
@ -923,8 +923,7 @@ namespace MWRender
return true;
}
bool ObjectPaging::blacklistObject(
int type, const ESM::RefNum& refnum, const osg::Vec3f& pos, const osg::Vec2i& cell)
bool ObjectPaging::blacklistObject(int type, ESM::RefNum refnum, const osg::Vec3f& pos, const osg::Vec2i& cell)
{
if (!typeFilter(type, false))
return false;

@ -41,11 +41,10 @@ namespace MWRender
unsigned int getNodeMask() override;
/// @return true if view needs rebuild
bool enableObject(
int type, const ESM::RefNum& refnum, const osg::Vec3f& pos, const osg::Vec2i& cell, bool enabled);
bool enableObject(int type, ESM::RefNum refnum, const osg::Vec3f& pos, const osg::Vec2i& cell, bool enabled);
/// @return true if view needs rebuild
bool blacklistObject(int type, const ESM::RefNum& refnum, const osg::Vec3f& pos, const osg::Vec2i& cell);
bool blacklistObject(int type, ESM::RefNum refnum, const osg::Vec3f& pos, const osg::Vec2i& cell);
void clear();

@ -1644,7 +1644,7 @@ namespace MWRender
{
if (!ptr.isInCell() || !ptr.getCell()->isExterior() || !mObjectPaging)
return;
const ESM::RefNum& refnum = ptr.getCellRef().getRefNum();
ESM::RefNum refnum = ptr.getCellRef().getRefNum();
if (!refnum.hasContentFile())
return;
if (mObjectPaging->blacklistObject(type, refnum, ptr.getCellRef().getPosition().asVec3(),

@ -30,17 +30,17 @@ namespace MWWorld
{
}
const ESM::RefNum& CellRef::getRefNum() const noexcept
ESM::RefNum CellRef::getRefNum() const noexcept
{
return std::visit(ESM::VisitOverload{
[&](const ESM4::Reference& ref) -> const ESM::RefNum& { return ref.mId; },
[&](const ESM4::ActorCharacter& ref) -> const ESM::RefNum& { return ref.mId; },
[&](const ESM::CellRef& ref) -> const ESM::RefNum& { return ref.mRefNum; },
[&](const ESM4::Reference& ref) -> ESM::RefNum { return ref.mId; },
[&](const ESM4::ActorCharacter& ref) -> ESM::RefNum { return ref.mId; },
[&](const ESM::CellRef& ref) -> ESM::RefNum { return ref.mRefNum; },
},
mCellRef.mVariant);
}
const ESM::RefNum& CellRef::getOrAssignRefNum(ESM::RefNum& lastAssignedRefNum)
ESM::RefNum CellRef::getOrAssignRefNum(ESM::RefNum& lastAssignedRefNum)
{
ESM::RefNum& refNum = std::visit(ESM::VisitOverload{
[&](ESM4::Reference& ref) -> ESM::RefNum& { return ref.mId; },

@ -27,11 +27,11 @@ namespace MWWorld
explicit CellRef(const ESM4::ActorCharacter& ref);
// Note: Currently unused for items in containers
const ESM::RefNum& getRefNum() const noexcept;
ESM::RefNum getRefNum() const noexcept;
// Returns RefNum.
// If RefNum is not set, assigns a generated one and changes the "lastAssignedRefNum" counter.
const ESM::RefNum& getOrAssignRefNum(ESM::RefNum& lastAssignedRefNum);
ESM::RefNum getOrAssignRefNum(ESM::RefNum& lastAssignedRefNum);
void setRefNum(ESM::RefNum refNum);

@ -38,7 +38,7 @@ namespace MWWorld
}
/// Remove all references with the given refNum from this list.
void remove(const ESM::RefNum& refNum)
void remove(ESM::RefNum refNum)
{
for (typename List::iterator it = mList.begin(); it != mList.end();)
{

@ -660,10 +660,10 @@ namespace MWWorld
class RefNumSearchVisitor
{
const ESM::RefNum& mRefNum;
ESM::RefNum mRefNum;
public:
RefNumSearchVisitor(const ESM::RefNum& refNum)
RefNumSearchVisitor(ESM::RefNum refNum)
: mRefNum(refNum)
{
}

@ -45,7 +45,7 @@ namespace MWWorld
void remove(const LiveCellRefBase& ref) noexcept
{
const ESM::RefNum& refNum = ref.mRef.getRefNum();
ESM::RefNum refNum = ref.mRef.getRefNum();
if (!refNum.isSet())
return;
auto it = mIndex.find(refNum);

@ -111,7 +111,7 @@ namespace
std::string model = getModel(ptr);
const auto rotation = makeDirectNodeRotation(ptr);
const ESM::RefNum& refnum = ptr.getCellRef().getRefNum();
ESM::RefNum refnum = ptr.getCellRef().getRefNum();
if (!refnum.hasContentFile() || !std::binary_search(pagedRefs.begin(), pagedRefs.end(), refnum))
ptr.getClass().insertObjectRendering(ptr, model, rendering);
else
@ -259,7 +259,7 @@ namespace
return false;
}
bool removeFromSorted(const ESM::RefNum& refNum, std::vector<ESM::RefNum>& pagedRefs)
bool removeFromSorted(ESM::RefNum refNum, std::vector<ESM::RefNum>& pagedRefs)
{
const auto it = std::lower_bound(pagedRefs.begin(), pagedRefs.end(), refNum);
if (it == pagedRefs.end() || *it != refNum)
@ -274,7 +274,7 @@ namespace MWWorld
void Scene::removeFromPagedRefs(const Ptr& ptr)
{
const ESM::RefNum& refnum = ptr.getCellRef().getRefNum();
ESM::RefNum refnum = ptr.getCellRef().getRefNum();
if (refnum.hasContentFile() && removeFromSorted(refnum, mPagedRefs))
{
if (!ptr.getRefData().getBaseNode())

@ -79,8 +79,7 @@ namespace Resource
Log(Debug::Debug) << "Loaded " << cellRefs.size() << " cell refs";
const auto getKey
= [](const EsmLoader::Record<CellRef>& v) -> const ESM::RefNum& { return v.mValue.mRefNum; };
const auto getKey = [](const EsmLoader::Record<CellRef>& v) -> ESM::RefNum { return v.mValue.mRefNum; };
std::vector<CellRef> result = prepareRecords(cellRefs, getKey);
Log(Debug::Debug) << "Prepared " << result.size() << " unique cell refs";

Loading…
Cancel
Save