mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 01:04:06 +00:00
Fix incompatible mods start: show both incompatible and enabled mods;
As noted by Angen ina26535d023, refs3bcf360107When starting with incompatible mods, the non-incompatible mods were no longer shown. This fixes that. I think the code looks cleaner from this new control flow that explicitly only mounts "mod". Tested by: Angen Differential Revision: https://code.wildfiregames.com/D3996 This was SVN commit r25510.
This commit is contained in:
@@ -118,7 +118,8 @@ function getMod(folder)
|
||||
function loadEnabledMods()
|
||||
{
|
||||
if (g_HasIncompatibleMods)
|
||||
g_ModsEnabled = Engine.GetIncompatibleMods().filter(folder => folder != "mod");
|
||||
g_ModsEnabled = Engine.GetEnabledMods().concat(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);
|
||||
|
||||
@@ -893,12 +893,13 @@ bool Init(const CmdLineArgs& args, int flags)
|
||||
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());
|
||||
// If there are incompatible mods, switch to the mod selector so players can resolve the problem.
|
||||
if (g_Mods.GetIncompatibleMods().empty())
|
||||
MountMods(Paths(args), g_Mods.GetEnabledMods());
|
||||
else
|
||||
MountMods(Paths(args), { "mod" });
|
||||
|
||||
// Special command-line mode to dump the entity schemas instead of running the game.
|
||||
// (This must be done after loading VFS etc, but should be done before wasting time
|
||||
|
||||
@@ -159,12 +159,6 @@ const std::vector<CStr>& Mod::GetIncompatibleMods() const
|
||||
return m_IncompatibleMods;
|
||||
}
|
||||
|
||||
void Mod::SwitchToModSelector(const ScriptInterface& scriptInterface)
|
||||
{
|
||||
m_ModsLoaded = { "mod" };
|
||||
CacheEnabledModVersions(scriptInterface);
|
||||
}
|
||||
|
||||
bool Mod::EnableMods(const ScriptInterface& scriptInterface, const std::vector<CStr>& mods, const bool addPublic)
|
||||
{
|
||||
m_IncompatibleMods.clear();
|
||||
|
||||
@@ -36,13 +36,6 @@ public:
|
||||
const std::vector<CStr>& GetEnabledMods() const;
|
||||
const std::vector<CStr>& GetIncompatibleMods() const;
|
||||
|
||||
/**
|
||||
* 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 SwitchToModSelector(const ScriptInterface& scriptInterface);
|
||||
|
||||
/**
|
||||
* Enables specified mods (& mods required by the engine).
|
||||
* @param addPublic - if true, enable the public mod.
|
||||
|
||||
Reference in New Issue
Block a user