diff --git a/SPID/include/LinkedDistribution.h b/SPID/include/LinkedDistribution.h
index d66c6a7..5fb6bf1 100644
--- a/SPID/include/LinkedDistribution.h
+++ b/SPID/include/LinkedDistribution.h
@@ -22,6 +22,22 @@ namespace LinkedDistribution
kGlobal
};
+ ///
+ /// Type of the distribution that is being linked to.
+ ///
+ enum DistributionType : std::uint8_t
+ {
+ ///
+ /// Regular distribution that occurs during normal distribution pass.
+ ///
+ kRegular,
+
+ ///
+ /// Distribution that occurs when an NPC dies.
+ ///
+ kDeath
+ };
+
namespace INI
{
struct RawLinkedForm
@@ -40,7 +56,7 @@ namespace LinkedDistribution
};
using LinkedFormsVec = std::vector;
- using LinkedFormsConfig = std::unordered_map;
+ using LinkedFormsConfig = std::unordered_map>;
inline LinkedFormsConfig linkedForms{};
@@ -70,7 +86,7 @@ namespace LinkedDistribution
friend Manager; // allow Manager to later modify forms directly.
friend Form* detail::LookupLinkedForm(RE::TESDataHandler* const, INI::RawLinkedForm&);
- using FormsMap = std::unordered_map>>;
+ using FormsMap = std::unordered_map>>>;
LinkedForms(RECORD::TYPE type) :
type(type)
@@ -79,13 +95,13 @@ namespace LinkedDistribution
RECORD::TYPE GetType() const { return type; }
const FormsMap& GetForms() const { return forms; }
- void LookupForms(RE::TESDataHandler* const dataHandler, INI::LinkedFormsVec& rawLinkedForms);
+ void LookupForms(RE::TESDataHandler* const, DistributionType, INI::LinkedFormsVec& rawLinkedForms);
private:
RECORD::TYPE type;
FormsMap forms{};
- void Link(Form*, Scope, const FormVec& linkedForms, const IndexOrCount&, const PercentChance&, const Path&);
+ void Link(Form*, Scope, DistributionType, const FormVec& linkedForms, const IndexOrCount&, const PercentChance&, const Path&);
};
class Manager : public ISingleton
@@ -98,33 +114,29 @@ namespace LinkedDistribution
///
/// A DataHandler that will perform the actual lookup.
/// A raw linked form entries that should be processed.
- void LookupLinkedForms(RE::TESDataHandler* const dataHandler, INI::LinkedFormsConfig& rawLinkedForms = INI::linkedForms);
+ void LookupLinkedForms(RE::TESDataHandler* const, INI::LinkedFormsConfig& rawLinkedForms = INI::linkedForms);
void LogLinkedFormsLookup();
///
/// Calculates DistributionSet for each linked form and calls a callback for each of them.
///
+ /// Type of the distribution for which linked sets should be returned.
/// A set of forms for which distribution sets should be calculated.
/// This is typically distributed forms accumulated during first distribution pass.
/// A callback to be called with each DistributionSet. This is supposed to do the actual distribution.
- void ForEachLinkedDistributionSet(const DistributedForms& linkedForms, std::function distribute);
+ void ForEachLinkedDistributionSet(DistributionType, const DistributedForms& linkedForms, std::function distribute);
- ///
- /// Calculates DistributionSet with only DeathItems for each linked form and calls a callback for each of them.
- /// This method is suitable for distributing items on death.
- ///
- /// A set of forms for which distribution sets should be calculated.
- /// This is typically distributed forms accumulated during first distribution pass.
- /// A callback to be called with each DistributionSet. This is supposed to do the actual distribution.
- void ForEachLinkedDeathDistributionSet(const DistributedForms& linkedForms, std::function distribute);
+ bool IsEmpty(DistributionType) const;
private:
template
- DataVec