mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-21 07:23:54 +00:00
Clean up global setting groups, don't try to destroy setting pages before they were rendered
This commit is contained in:
parent
e88e92d3aa
commit
ef730c4395
1 changed files with 12 additions and 7 deletions
|
@ -386,7 +386,9 @@ local function onGroupRegistered(global, key)
|
||||||
|
|
||||||
if not pages[group.page] then return end
|
if not pages[group.page] then return end
|
||||||
if pageOptions[group.page] then
|
if pageOptions[group.page] then
|
||||||
|
if pageOptions[group.page].element then
|
||||||
pageOptions[group.page].element:destroy()
|
pageOptions[group.page].element:destroy()
|
||||||
|
end
|
||||||
else
|
else
|
||||||
pageOptions[group.page] = {}
|
pageOptions[group.page] = {}
|
||||||
end
|
end
|
||||||
|
@ -423,21 +425,24 @@ local menuPages = {}
|
||||||
local function resetPlayerGroups()
|
local function resetPlayerGroups()
|
||||||
local playerGroupsSection = storage.playerSection(common.groupSectionKey)
|
local playerGroupsSection = storage.playerSection(common.groupSectionKey)
|
||||||
for pageKey, page in pairs(groups) do
|
for pageKey, page in pairs(groups) do
|
||||||
for groupKey, group in pairs(page) do
|
for groupKey in pairs(page) do
|
||||||
if not menuGroups[groupKey] and not group.global then
|
if not menuGroups[groupKey] then
|
||||||
page[groupKey] = nil
|
page[groupKey] = nil
|
||||||
playerGroupsSection:set(groupKey, nil)
|
playerGroupsSection:set(groupKey, nil)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if pageOptions[pageKey] then
|
local options = pageOptions[pageKey]
|
||||||
pageOptions[pageKey].element:destroy()
|
if options then
|
||||||
|
if options.element then
|
||||||
|
options.element:destroy()
|
||||||
|
end
|
||||||
if not menuPages[pageKey] then
|
if not menuPages[pageKey] then
|
||||||
ui.removeSettingsPage(pageOptions[pageKey])
|
ui.removeSettingsPage(options)
|
||||||
pageOptions[pageKey] = nil
|
pageOptions[pageKey] = nil
|
||||||
else
|
else
|
||||||
local renderedOptions = renderPage(pages[pageKey])
|
local renderedOptions = renderPage(pages[pageKey])
|
||||||
for k, v in pairs(renderedOptions) do
|
for k, v in pairs(renderedOptions) do
|
||||||
pageOptions[pageKey][k] = v
|
options[k] = v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue