Rename ModsLoaded to EnabledMods
Differential Revision: https://code.wildfiregames.com/D3987 This was SVN commit r25516.
This commit is contained in:
parent
d7a4fb7c20
commit
c535a282ac
@ -151,7 +151,7 @@ JS::Value Mod::GetAvailableMods(const ScriptInterface& scriptInterface) const
|
||||
|
||||
const std::vector<CStr>& Mod::GetEnabledMods() const
|
||||
{
|
||||
return m_ModsLoaded;
|
||||
return m_EnabledMods;
|
||||
}
|
||||
|
||||
const std::vector<CStr>& Mod::GetIncompatibleMods() const
|
||||
@ -162,7 +162,7 @@ const std::vector<CStr>& Mod::GetIncompatibleMods() const
|
||||
bool Mod::EnableMods(const ScriptInterface& scriptInterface, const std::vector<CStr>& mods, const bool addPublic)
|
||||
{
|
||||
m_IncompatibleMods.clear();
|
||||
m_ModsLoaded.clear();
|
||||
m_EnabledMods.clear();
|
||||
|
||||
std::unordered_map<CStr, int> counts;
|
||||
for (const CStr& mod : mods)
|
||||
@ -170,21 +170,21 @@ bool Mod::EnableMods(const ScriptInterface& scriptInterface, const std::vector<C
|
||||
// Ignore duplicates.
|
||||
if (counts.try_emplace(mod, 0).first->second++ > 0)
|
||||
continue;
|
||||
m_ModsLoaded.emplace_back(mod);
|
||||
m_EnabledMods.emplace_back(mod);
|
||||
}
|
||||
|
||||
if (addPublic && counts["public"] == 0)
|
||||
m_ModsLoaded.insert(m_ModsLoaded.begin(), "public");
|
||||
m_EnabledMods.insert(m_EnabledMods.begin(), "public");
|
||||
|
||||
if (counts["mod"] == 0)
|
||||
m_ModsLoaded.insert(m_ModsLoaded.begin(), "mod");
|
||||
m_EnabledMods.insert(m_EnabledMods.begin(), "mod");
|
||||
|
||||
ScriptRequest rq(scriptInterface);
|
||||
JS::RootedValue availableMods(rq.cx, GetAvailableMods(scriptInterface));
|
||||
m_IncompatibleMods = CheckForIncompatibleMods(scriptInterface, m_ModsLoaded, availableMods);
|
||||
m_IncompatibleMods = CheckForIncompatibleMods(scriptInterface, m_EnabledMods, availableMods);
|
||||
|
||||
for (const CStr& mod : m_IncompatibleMods)
|
||||
m_ModsLoaded.erase(std::find(m_ModsLoaded.begin(), m_ModsLoaded.end(), mod));
|
||||
m_EnabledMods.erase(std::find(m_EnabledMods.begin(), m_EnabledMods.end(), mod));
|
||||
|
||||
CacheEnabledModVersions(scriptInterface);
|
||||
|
||||
@ -317,7 +317,7 @@ void Mod::CacheEnabledModVersions(const ScriptInterface& scriptInterface)
|
||||
|
||||
m_LoadedModVersions.clear();
|
||||
|
||||
for (const CStr& mod : m_ModsLoaded)
|
||||
for (const CStr& mod : m_EnabledMods)
|
||||
{
|
||||
// Ignore mod mod as it is irrelevant for compatibility checks
|
||||
if (mod == "mod")
|
||||
|
@ -76,7 +76,7 @@ private:
|
||||
std::vector<CStr> CheckForIncompatibleMods(const ScriptInterface& scriptInterface, const std::vector<CStr>& mods, const JS::RootedValue& availableMods) const;
|
||||
bool CompareVersionStrings(const CStr& required, const CStr& op, const CStr& version) const;
|
||||
|
||||
std::vector<CStr> m_ModsLoaded;
|
||||
std::vector<CStr> m_EnabledMods;
|
||||
// Of the currently loaded mods, these are the incompatible with the engine and cannot be loaded.
|
||||
std::vector<CStr> m_IncompatibleMods;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user