Skip to content

Commit

Permalink
feat: add TESObjectREFR::LookupByHandle
Browse files Browse the repository at this point in the history
  • Loading branch information
qudix committed Sep 29, 2024
1 parent a09f171 commit a8340bf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
3 changes: 3 additions & 0 deletions include/RE/T/TESObjectREFR.h
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@ namespace RE
virtual void Unk_12E(); // 12E
virtual void Unk_12F(); // 12F

static NiPointer<TESObjectREFR> LookupByHandle(RefHandle a_refHandle);
static bool LookupByHandle(RefHandle a_refHandle, NiPointer<TESObjectREFR>& a_refrOut);

void ForEachEquippedItem(std::function<BSContainer::ForEachResult(const BGSInventoryItem&)> a_callback) const;
void ForEachInventoryItem(std::function<BSContainer::ForEachResult(const BGSInventoryItem&)> a_callback) const;

Expand Down
21 changes: 17 additions & 4 deletions src/RE/T/TESObjectREFR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,20 @@

#include "RE/B/BGSInventoryItem.h"
#include "RE/E/ExtraLock.h"
#include "RE/M/Misc.h"

namespace RE
{
void TESObjectREFR::AddLockChange()
NiPointer<TESObjectREFR> TESObjectREFR::LookupByHandle(RefHandle a_refHandle)
{
using func_t = decltype(&TESObjectREFR::AddLockChange);
static REL::Relocation<func_t> func{ ID::TESObjectREFR::AddLockChange };
return func(this);
NiPointer<TESObjectREFR> ref;
LookupReferenceByHandle(a_refHandle, ref);
return ref;
}

bool TESObjectREFR::LookupByHandle(RefHandle a_refHandle, NiPointer<TESObjectREFR>& a_refrOut)
{
return LookupReferenceByHandle(a_refHandle, a_refrOut);
}

void TESObjectREFR::ForEachEquippedItem(std::function<BSContainer::ForEachResult(const BGSInventoryItem&)> a_callback) const
Expand Down Expand Up @@ -154,4 +160,11 @@ namespace RE
AddLockChange();
}
}

void TESObjectREFR::AddLockChange()
{
using func_t = decltype(&TESObjectREFR::AddLockChange);
static REL::Relocation<func_t> func{ ID::TESObjectREFR::AddLockChange };
return func(this);
}
}

0 comments on commit a8340bf

Please sign in to comment.