Fix mistake in 3bcf360107
which stopped the incompatible mods page from showing.
I didn't quite understand what was supposed to happen here. This makes things work as before. While at it, fix a conversion bug & do some more tweaks. Differential Revision: https://code.wildfiregames.com/D3990 This was SVN commit r25475.
This commit is contained in:
parent
3bcf360107
commit
a26535d023
@ -118,7 +118,7 @@ function getMod(folder)
|
||||
function loadEnabledMods()
|
||||
{
|
||||
if (g_HasIncompatibleMods)
|
||||
g_ModsEnabled = Engine.GetFailedMods().filter(folder => folder != "mod");
|
||||
g_ModsEnabled = Engine.GetIncompatibleMods().filter(folder => folder != "mod");
|
||||
else
|
||||
g_ModsEnabled = Engine.GetEnabledMods().filter(folder => !!g_Mods[folder]);
|
||||
g_ModsDisabled = Object.keys(g_Mods).filter(folder => g_ModsEnabled.indexOf(folder) == -1);
|
||||
@ -446,7 +446,7 @@ function selectedMod(listObjectName)
|
||||
toggleModButton.caption = isPickedDisabledList ?
|
||||
translateWithContext("mod activation", "Enable") :
|
||||
translateWithContext("mod activation", "Disable");
|
||||
toggleModButton.enabled = isPickedDisabledList ? isModSelected && g_ModsCompatibility[listObject.list[listObject.selected]] : isModSelected;
|
||||
toggleModButton.enabled = isPickedDisabledList ? isModSelected && g_ModsCompatibility[listObject.list[listObject.selected]] || false : isModSelected;
|
||||
Engine.GetGUIObjectByName("enabledModUp").enabled = isModSelected && listObjectName == "modsEnabledList" && !areFilters();
|
||||
Engine.GetGUIObjectByName("enabledModDown").enabled = isModSelected && listObjectName == "modsEnabledList" && !areFilters();
|
||||
|
||||
|
@ -906,14 +906,9 @@ bool Init(const CmdLineArgs& args, int flags)
|
||||
LOGERROR("Trying to start with incompatible mods: %s.", boost::algorithm::join(g_Mods.GetIncompatibleMods(), ", "));
|
||||
return false;
|
||||
}
|
||||
LOGWARNING("Invalid mods specified, starting with default mods.");
|
||||
g_Mods.EnableDefaultMods(modInterface);
|
||||
}
|
||||
// Sanity check.
|
||||
if (!g_Mods.GetIncompatibleMods().empty())
|
||||
{
|
||||
LOGERROR("Trying to start with incompatible mods: %s.", boost::algorithm::join(g_Mods.GetIncompatibleMods(), ", "));
|
||||
return false;
|
||||
// Disable all mods but "mod", we want to use the JS fallback code.
|
||||
// TODO: it'd be nicer if the control flow was more obvious here.
|
||||
g_Mods.SwitchToModSelector(modInterface);
|
||||
}
|
||||
}
|
||||
MountMods(Paths(args), g_Mods.GetEnabledMods());
|
||||
|
@ -159,11 +159,9 @@ const std::vector<CStr>& Mod::GetIncompatibleMods() const
|
||||
return m_IncompatibleMods;
|
||||
}
|
||||
|
||||
void Mod::EnableDefaultMods(const ScriptInterface& scriptInterface)
|
||||
void Mod::SwitchToModSelector(const ScriptInterface& scriptInterface)
|
||||
{
|
||||
m_IncompatibleMods.clear();
|
||||
m_ModsLoaded.clear();
|
||||
m_ModsLoaded.insert(m_ModsLoaded.begin(), "mod");
|
||||
m_ModsLoaded = { "mod" };
|
||||
CacheEnabledModVersions(scriptInterface);
|
||||
}
|
||||
|
||||
|
@ -37,9 +37,11 @@ public:
|
||||
const std::vector<CStr>& GetIncompatibleMods() const;
|
||||
|
||||
/**
|
||||
* Enable the default mods. De-activates any non-default mod currently enabled.
|
||||
* Enables the mod selector only, leaving incompatible mods as-is.
|
||||
* This is used, in combination with the JS code, to show the user
|
||||
* a clear interface in case of incompatible mods.
|
||||
*/
|
||||
void EnableDefaultMods(const ScriptInterface& scriptInterface);
|
||||
void SwitchToModSelector(const ScriptInterface& scriptInterface);
|
||||
|
||||
/**
|
||||
* Enables specified mods (& mods required by the engine).
|
||||
|
Loading…
Reference in New Issue
Block a user