From ee8e8cb3bce6a97bdb31e29a53af301be791f259 Mon Sep 17 00:00:00 2001 From: powerof3 <32599957+powerof3@users.noreply.github.com> Date: Thu, 15 Feb 2024 15:17:54 +0530 Subject: [PATCH] Fix race and leveled filters --- SPID/include/LookupNPC.h | 6 ------ SPID/src/LookupFilters.cpp | 8 +++++--- SPID/src/LookupNPC.cpp | 27 +++------------------------ extern/CommonLibSSE | 2 +- 4 files changed, 9 insertions(+), 34 deletions(-) diff --git a/SPID/include/LookupNPC.h b/SPID/include/LookupNPC.h index 795efd0..7f3be01 100644 --- a/SPID/include/LookupNPC.h +++ b/SPID/include/LookupNPC.h @@ -19,9 +19,6 @@ namespace NPC [[nodiscard]] bool HasFormFilter(const FormVec& a_forms, bool all = false) const; [[nodiscard]] std::uint16_t GetLevel() const; - [[nodiscard]] RE::SEX GetSex() const; - [[nodiscard]] bool IsUnique() const; - [[nodiscard]] bool IsSummonable() const; [[nodiscard]] bool IsChild() const; [[nodiscard]] bool IsLeveled() const; [[nodiscard]] bool IsTeammate() const; @@ -55,9 +52,6 @@ namespace NPC std::string name; StringSet keywords{}; std::uint16_t level; - RE::SEX sex; - bool unique; - bool summonable; bool child; bool teammate; bool leveled; diff --git a/SPID/src/LookupFilters.cpp b/SPID/src/LookupFilters.cpp index 78328e2..aa4a0ab 100644 --- a/SPID/src/LookupFilters.cpp +++ b/SPID/src/LookupFilters.cpp @@ -145,14 +145,16 @@ namespace Filter Result Data::passed_trait_filters(const NPCData& a_npcData) const { + auto npc = a_npcData.GetNPC(); + // Traits - if (traits.sex && a_npcData.GetSex() != *traits.sex) { + if (traits.sex && npc->GetSex() != *traits.sex) { return Result::kFail; } - if (traits.unique && a_npcData.IsUnique() != *traits.unique) { + if (traits.unique && npc->IsUnique() != *traits.unique) { return Result::kFail; } - if (traits.summonable && a_npcData.IsSummonable() != *traits.summonable) { + if (traits.summonable && npc->IsSummonable() != *traits.summonable) { return Result::kFail; } if (traits.child && a_npcData.IsChild() != *traits.child) { diff --git a/SPID/src/LookupNPC.cpp b/SPID/src/LookupNPC.cpp index 18e4558..8fc9d3a 100644 --- a/SPID/src/LookupNPC.cpp +++ b/SPID/src/LookupNPC.cpp @@ -30,13 +30,11 @@ namespace NPC Data::Data(RE::Actor* a_actor, RE::TESNPC* a_npc) : npc(a_npc), actor(a_actor), - race(a_npc->GetRace()), + race(a_actor->GetRace()), name(a_actor->GetName()), level(a_npc->GetLevel()), - sex(a_npc->GetSex()), - unique(a_npc->IsUnique()), - summonable(a_npc->IsSummonable()), - child(a_actor->IsChild() || race && race->formEditorID.contains("RaceChild")) + child(a_actor->IsChild() || race && race->formEditorID.contains("RaceChild")), + leveled(a_actor->IsLeveled()) { npc->ForEachKeyword([&](const RE::BGSKeyword* a_keyword) { keywords.emplace(a_keyword->GetFormEditorID()); @@ -48,11 +46,7 @@ namespace NPC IDs.emplace_back(originalBase); } if (const auto templateBase = extraLvlCreature->templateBase) { - leveled = true; IDs.emplace_back(templateBase); - if (const auto templateRace = templateBase->As()->GetRace()) { - race = templateRace; - } } } else { IDs.emplace_back(npc); @@ -193,21 +187,6 @@ namespace NPC return level; } - RE::SEX Data::GetSex() const - { - return sex; - } - - bool Data::IsUnique() const - { - return unique; - } - - bool Data::IsSummonable() const - { - return summonable; - } - bool Data::IsChild() const { return child; diff --git a/extern/CommonLibSSE b/extern/CommonLibSSE index 78f140e..37c738c 160000 --- a/extern/CommonLibSSE +++ b/extern/CommonLibSSE @@ -1 +1 @@ -Subproject commit 78f140e3878f241b40d0004ae3bd9f30f7a2fa74 +Subproject commit 37c738cfd4485628e5fa503c9833e6113e4d6abc