1
0
forked from mirrors/0ad

Fix downloanded mods not showing in list until restart

since 498f0d420b
While at it, remove not used variable after 6400a4a0c5
also fix non visual replay broken in 6400a4a0c5

Differential revision: D4220
Tested by: @Stan, @Langbart
Fixes: #6288

This was SVN commit r25853.
This commit is contained in:
Angen
2021-08-22 09:54:16 +00:00
parent 2cf908a974
commit 83bb6f3ed5
7 changed files with 10 additions and 6 deletions
+2
View File
@@ -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;
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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.
+1
View File
@@ -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:
+2 -1
View File
@@ -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());
+2 -2
View File
@@ -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();