diff --git a/SPID/include/DependencyResolver.h b/SPID/include/DependencyResolver.h index e1a6da2..0d8e1f6 100644 --- a/SPID/include/DependencyResolver.h +++ b/SPID/include/DependencyResolver.h @@ -155,6 +155,7 @@ class DependencyResolver for (const auto& pair : nodes) { delete pair.second; } + nodes.clear(); } /// Attempts to create a dependency rule between `parent` and `dependency` objects. diff --git a/SPID/src/DistributeManager.cpp b/SPID/src/DistributeManager.cpp index f65c36e..851178e 100644 --- a/SPID/src/DistributeManager.cpp +++ b/SPID/src/DistributeManager.cpp @@ -33,9 +33,16 @@ namespace Distribute static bool thunk(RE::Character* a_this) { if (const auto npc = a_this->GetActorBase()) { - if (detail::should_process_NPC(npc)) { + const auto process = detail::should_process_NPC(npc); + const auto processOnLoad = detail::should_process_NPC(npc, processedOnLoad); + if (process || processOnLoad) { auto npcData = NPCData(a_this, npc); - Distribute(npcData, false); + if (process) { + Distribute(npcData, false, true); + } + if (processOnLoad) { + DistributeItemOutfits(npcData, { a_this, npc, false }); + } } } @@ -113,6 +120,9 @@ namespace Distribute if (processedOutfit = factory->Create(); processedOutfit) { processedOutfit->formEditorID = "SPID_ProcessedOutfit"; } + if (processedOnLoad = factory->Create(); processedOnLoad) { + processedOnLoad->formEditorID = "SPID_ProcessedOnLoad"; + } } if (Forms::GetTotalLeveledEntries() > 0) { diff --git a/SPID/src/KeywordDependencies.cpp b/SPID/src/KeywordDependencies.cpp index 718f874..fc9cc31 100644 --- a/SPID/src/KeywordDependencies.cpp +++ b/SPID/src/KeywordDependencies.cpp @@ -67,7 +67,8 @@ void Dependencies::ResolveKeywords() return; } - const auto startTime = std::chrono::steady_clock::now(); + Timer timer; + timer.start(); // Pre-build a map of all available keywords by names. StringMap allKeywords{}; @@ -140,7 +141,8 @@ void Dependencies::ResolveKeywords() } const auto result = resolver.resolve(); - const auto endTime = std::chrono::steady_clock::now(); + + timer.end(); keywordForms.clear(); logger::info("\tSorted keywords :"); @@ -154,6 +156,7 @@ void Dependencies::ResolveKeywords() } } - const auto duration = std::chrono::duration_cast(endTime - startTime).count(); - logger::info("\tKeyword resolution took {}μs / {}ms", duration, duration / 1000.0f); + logger::info("\tKeyword resolution took {}μs / {}ms", timer.duration_μs(), timer.duration_ms()); + + allKeywords.clear(); }