forked from mirrors/0ad
Fix downloanded mods not showing in list until restart
since498f0d420bWhile at it, remove not used variable after6400a4a0c5also fix non visual replay broken in6400a4a0c5Differential revision: D4220 Tested by: @Stan, @Langbart Fixes: #6288 This was SVN commit r25853.
This commit is contained in:
@@ -193,6 +193,8 @@ static InReaction MainInputHandler(const SDL_Event_* ev)
|
||||
else
|
||||
{
|
||||
LOGMESSAGE("Installed mod %s", installer.GetInstalledMods().front());
|
||||
ScriptInterface modInterface("Engine", "Mod", g_ScriptContext);
|
||||
g_Mods.UpdateAvailableMods(modInterface);
|
||||
RestartEngine();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -877,7 +877,7 @@ bool Init(const CmdLineArgs& args, int flags)
|
||||
boost::split(mods, modsStr, boost::algorithm::is_space(), boost::token_compress_on);
|
||||
}
|
||||
|
||||
if (!g_Mods.EnableMods(modInterface, mods, flags & INIT_MODS_PUBLIC))
|
||||
if (!g_Mods.EnableMods(mods, flags & INIT_MODS_PUBLIC))
|
||||
{
|
||||
// In non-visual mode, fail entirely.
|
||||
if (args.Has("autostart-nonvisual"))
|
||||
|
||||
+1
-1
@@ -136,7 +136,7 @@ const std::vector<Mod::ModData>& Mod::GetAvailableMods() const
|
||||
return m_AvailableMods;
|
||||
}
|
||||
|
||||
bool Mod::EnableMods(const ScriptInterface& scriptInterface, const std::vector<CStr>& mods, const bool addPublic)
|
||||
bool Mod::EnableMods(const std::vector<CStr>& mods, const bool addPublic)
|
||||
{
|
||||
m_IncompatibleMods.clear();
|
||||
m_EnabledMods.clear();
|
||||
|
||||
+1
-1
@@ -72,7 +72,7 @@ public:
|
||||
* @return whether the mods were enabled successfully. This can fail if e.g. mods are incompatible.
|
||||
* If true, GetEnabledMods() should be non-empty, GetIncompatibleMods() empty. Otherwise, GetIncompatibleMods() is non-empty.
|
||||
*/
|
||||
bool EnableMods(const ScriptInterface& scriptInterface, const std::vector<CStr>& mods, const bool addPublic);
|
||||
bool EnableMods(const std::vector<CStr>& mods, const bool addPublic);
|
||||
|
||||
/**
|
||||
* Get data for the given mod.
|
||||
|
||||
@@ -486,6 +486,7 @@ bool ModIo::AdvanceRequest(const ScriptInterface& scriptInterface)
|
||||
Paths paths(g_CmdLineArgs);
|
||||
CModInstaller installer(paths.UserData() / "mods", paths.Cache());
|
||||
installer.Install(m_DownloadFilePath, g_ScriptContext, false);
|
||||
g_Mods.UpdateAvailableMods(scriptInterface);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -233,7 +233,8 @@ void CReplayPlayer::Replay(const bool serializationtest, const int rejointesttur
|
||||
mods.emplace_back(data.m_Pathname);
|
||||
|
||||
// Ignore the return value, we check below.
|
||||
g_Mods.EnableMods(scriptInterface, mods, false);
|
||||
g_Mods.UpdateAvailableMods(scriptInterface);
|
||||
g_Mods.EnableMods(mods, false);
|
||||
CheckReplayMods(replayMods);
|
||||
|
||||
MountMods(Paths(g_CmdLineArgs), g_Mods.GetEnabledMods());
|
||||
|
||||
@@ -156,9 +156,9 @@ bool AreModsPlayCompatible(const std::vector<Mod::ModData>& a, const std::vector
|
||||
return Mod::AreModsPlayCompatible(modsA, modsB);
|
||||
}
|
||||
|
||||
bool SetModsAndRestartEngine(const ScriptInterface& scriptInterface, const std::vector<CStr>& mods)
|
||||
bool SetModsAndRestartEngine(const std::vector<CStr>& mods)
|
||||
{
|
||||
if (!g_Mods.EnableMods(scriptInterface, mods, false))
|
||||
if (!g_Mods.EnableMods(mods, false))
|
||||
return false;
|
||||
|
||||
RestartEngine();
|
||||
|
||||
Reference in New Issue
Block a user