From 042789c042e36a9111fd288b835d122ba28eec9f Mon Sep 17 00:00:00 2001 From: Arkadii Hlushchevskyi Date: Fri, 19 Jul 2024 22:22:15 +0300 Subject: [PATCH] minor inconsequential stuff. --- SPID/include/OutfitManager.h | 13 +++++++++++++ SPID/src/OutfitManager.cpp | 6 +++--- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/SPID/include/OutfitManager.h b/SPID/include/OutfitManager.h index 6c99feb..dc2a2c3 100644 --- a/SPID/include/OutfitManager.h +++ b/SPID/include/OutfitManager.h @@ -9,6 +9,17 @@ namespace Outfits public: static void Register(); + /// + /// Checks whether the actor can technically wear a given outfit. + /// Actor can wear an outfit when all of its components are compatible with actor's race. + /// + /// This method doesn't validate any other logic. + /// + /// Target Actor to be tested + /// An outfit that needs to be equipped + /// True if the actor can wear the outfit, false otherwise + bool CanEquipOutfit(const RE::Actor*, RE::BGSOutfit*); + /// /// Sets given outfit as default outfit for the actor. /// @@ -16,6 +27,8 @@ namespace Outfits /// /// Target Actor for whom the outfit will be set. /// A new outfit to set as the default. + /// If true, the outfit will be set even if the actor already has a distributed outfit. + /// True if the outfit was successfully set, false otherwise. bool SetDefaultOutfit(RE::Actor*, RE::BGSOutfit*, bool allowOverwrites); /// diff --git a/SPID/src/OutfitManager.cpp b/SPID/src/OutfitManager.cpp index 8d69ea0..adc4b7e 100644 --- a/SPID/src/OutfitManager.cpp +++ b/SPID/src/OutfitManager.cpp @@ -129,7 +129,7 @@ namespace Outfits return RE::BSEventNotifyControl::kContinue; } - bool CanEquipOutfit(const RE::Actor* actor, RE::BGSOutfit* outfit) + bool Manager::CanEquipOutfit(const RE::Actor* actor, RE::BGSOutfit* outfit) { const auto race = actor->GetRace(); for (const auto& item : outfit->outfitItems) { @@ -155,7 +155,7 @@ namespace Outfits auto defaultOutfit = npc->defaultOutfit; if (!allowOverwrites && replacements.find(actor->formID) != replacements.end()) { - return true; + return true; // return true to indicate that some outfit was already set for this actor, and with overwrite disabled we won't be able to set any outfit. } if (!CanEquipOutfit(actor, outfit)) { @@ -165,7 +165,7 @@ namespace Outfits return false; } - actor->SetDefaultOutfit(outfit, false); // Having true here causes infinite loading. It seems that it works either way. + actor->SetDefaultOutfit(outfit, false); // Having true here causes infinite loading. It seems that equipping works either way, so we are good :) if (auto previous = replacements.find(actor->formID); previous != replacements.end()) { previous->second.distributed = outfit;