Skip to content

Commit

Permalink
Merge branch 'master' of github.com:beyond-all-reason/BYAR-Chobby int…
Browse files Browse the repository at this point in the history
…o beyond-all-reason_master
  • Loading branch information
FIr3baL committed Aug 7, 2024
2 parents 972ce51 + 906155c commit a8d8185
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 a8d8185

Please sign in to comment.