Skip to content

Commit

Permalink
feat: add SEX formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
qudix committed Jun 7, 2024
1 parent 475de71 commit 4573481
Showing 1 changed file with 32 additions and 7 deletions.
39 changes: 32 additions & 7 deletions CommonLibF4/include/RE/Bethesda/TESBoundAnimObjects.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ namespace RE
[[nodiscard]] TESContainer* GetContainer()
{
using func_t = decltype(&TESFurniture::GetContainer);
REL::Relocation<func_t> func{ REL::ID(2198043) };
static REL::Relocation<func_t> func{ REL::ID(2198043) };
return func(this);
}

Expand Down Expand Up @@ -403,7 +403,7 @@ namespace RE
[[nodiscard]] static TESNPC* GetDefaultNPC(TESNPC* npc)
{
using func_t = decltype(&TESNPC::GetDefaultNPC);
REL::Relocation<func_t> func{ REL::ID(1073775) };
static REL::Relocation<func_t> func{ REL::ID(1073775) };
return func(npc);
}

Expand Down Expand Up @@ -452,7 +452,7 @@ namespace RE
[[nodiscard]] SEX GetSex() noexcept
{
using func_t = decltype(&TESNPC::GetSex);
REL::Relocation<func_t> func{ REL::ID(2207107) };
static REL::Relocation<func_t> func{ REL::ID(2207107) };
return func(this);
}

Expand Down Expand Up @@ -483,7 +483,7 @@ namespace RE
float GetFacialBoneMorphIntensity()
{
using func_t = decltype(&TESNPC::GetFacialBoneMorphIntensity);
REL::Relocation<func_t> func{ REL::ID(2207416) };
static REL::Relocation<func_t> func{ REL::ID(2207416) };
return func(this);
}

Expand Down Expand Up @@ -581,21 +581,21 @@ namespace RE
LOCK_LEVEL GetHackDifficultyLockLevel(TESObjectREFR* a_refr)
{
using func_t = decltype(&BGSTerminal::GetHackDifficultyLockLevel);
REL::Relocation<func_t> func{ REL::ID(2197777) };
static REL::Relocation<func_t> func{ REL::ID(2197777) };
return func(this, a_refr);
}

static bool IsTerminalRefInUse(TESObjectREFR* a_refr)
{
using func_t = decltype(&BGSTerminal::IsTerminalRefInUse);
REL::Relocation<func_t> func{ REL::ID(2197779) };
static REL::Relocation<func_t> func{ REL::ID(2197779) };
return func(a_refr);
}

static void Show(TESObjectREFR* a_refr)
{
using func_t = decltype(&BGSTerminal::Show);
REL::Relocation<func_t> func{ REL::ID(2197776) };
static REL::Relocation<func_t> func{ REL::ID(2197776) };
return func(a_refr);
}

Expand All @@ -607,3 +607,28 @@ namespace RE
};
static_assert(sizeof(BGSTerminal) == 0x1E0);
}

template <>
struct std::formatter<RE::SEX>
{
template <class ParseContext>
constexpr auto parse(ParseContext& a_ctx)
{
return a_ctx.begin();
}

template <class FormatContext>
constexpr auto format(const RE::SEX& a_sex, FormatContext& a_ctx) const
{
switch (a_sex) {
case RE::SEX::kNone:
return format_to(a_ctx.out(), "None");
case RE::SEX::kMale:
return format_to(a_ctx.out(), "Male");
case RE::SEX::kFemale:
return format_to(a_ctx.out(), "Female");
}

return format_to(a_ctx.out(), "Unknown");
}
};

0 comments on commit 4573481

Please sign in to comment.