Skip to content

Commit

Permalink
Merge pull request #748 from FIr3baL/FB_Fix_Error_Readding_Archive
Browse files Browse the repository at this point in the history
FB_Fix_Error_Readding_Archive
  • Loading branch information
FIr3baL authored Aug 6, 2024
2 parents ee6dc48 + 0dc68de commit 906155c
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions LuaMenu/widgets/gui_modoptions_panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ local battleLobby
local localModoptions = {}
local modoptionControlNames = {}
local modoptions
local modoptionsByGame = {}

--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
Expand Down Expand Up @@ -737,19 +738,25 @@ function ModoptionsPanel.LoadModoptions(gameName, newBattleLobby)
return VFS.Include("modoptions.lua", nil, VFS.ZIP)
end

do
if modoptionsByGame[gameName] then
modoptions = modoptionsByGame[gameName]
else

local alreadyLoaded = false
for _, archive in pairs(VFS.GetLoadedArchives()) do
if archive == gameName then
alreadyLoaded = true
break
end
end

if alreadyLoaded then
modoptions = VFS.Include("modoptions.lua", nil, VFS.ZIP)
Spring.Log(LOG_SECTION, LOG.ERROR, "Game archive already loaded, cannot fetch modoptions")
else
modoptions = VFS.UseArchive(gameName, LoadModOptions)
modoptionsByGame[gameName] = modoptions
end

end


Expand Down

0 comments on commit 906155c

Please sign in to comment.