From 79ee0e34ea6e6c5322be77ec5fbb35fccd832ad4 Mon Sep 17 00:00:00 2001 From: BenDol Date: Tue, 1 Apr 2014 16:51:38 +1300 Subject: [PATCH] Keep g_settings as a 'static' variable rather than a direct object. --- modules/client/client.lua | 18 ++-- modules/client_entergame/characterlist.lua | 6 +- modules/client_entergame/entergame.lua | 42 +++++----- modules/client_locales/locales.lua | 4 +- modules/client_options/options.lua | 8 +- modules/client_serverlist/serverlist.lua | 4 +- modules/client_stats/stats.lua | 4 +- modules/client_terminal/terminal.lua | 8 +- modules/corelib/config.lua | 3 - modules/corelib/settings.lua | 82 ++++++++++++++++++- modules/corelib/ui/uiminiwindow.lua | 12 +-- modules/game_battle/battle.lua | 12 +-- .../game_combatcontrols/combatcontrols.lua | 6 +- modules/game_console/console.lua | 36 ++++---- modules/game_hotkeys/hotkeys_manager.lua | 8 +- modules/game_interface/gameinterface.lua | 4 +- modules/game_viplist/viplist.lua | 12 +-- modules/gamelib/ui/uiminimap.lua | 4 +- 18 files changed, 174 insertions(+), 99 deletions(-) diff --git a/modules/client/client.lua b/modules/client/client.lua index b3632c3f..eb7a81af 100644 --- a/modules/client/client.lua +++ b/modules/client/client.lua @@ -65,20 +65,20 @@ function init() else -- window size local size = { width = 800, height = 600 } - size = g_settings:getSize('window-size', size) + size = g_settings.getSize('window-size', size) g_window.resize(size) -- window position, default is the screen center local displaySize = g_window.getDisplaySize() local defaultPos = { x = (displaySize.width - size.width)/2, y = (displaySize.height - size.height)/2 } - local pos = g_settings:getPoint('window-pos', defaultPos) + local pos = g_settings.getPoint('window-pos', defaultPos) pos.x = math.max(pos.x, 0) pos.y = math.max(pos.y, 0) g_window.move(pos) -- window maximized? - local maximized = g_settings:getBoolean('window-maximized', false) + local maximized = g_settings.getBoolean('window-maximized', false) if maximized then g_window.maximize() end end @@ -91,9 +91,9 @@ function init() g_keyboard.bindKeyDown('Ctrl+Shift+R', reloadScripts) -- generate machine uuid, this is a security measure for storing passwords - if not g_crypt.setMachineUUID(g_settings:get('uuid')) then - g_settings:set('uuid', g_crypt.getMachineUUID()) - g_settings:save() + if not g_crypt.setMachineUUID(g_settings.get('uuid')) then + g_settings.set('uuid', g_crypt.getMachineUUID()) + g_settings.save() end end @@ -101,9 +101,9 @@ function terminate() disconnect(g_app, { onRun = startup, onExit = exit }) -- save window configs - g_settings:set('window-size', g_window.getUnmaximizedSize()) - g_settings:set('window-pos', g_window.getUnmaximizedPos()) - g_settings:set('window-maximized', g_window.isMaximized()) + g_settings.set('window-size', g_window.getUnmaximizedSize()) + g_settings.set('window-pos', g_window.getUnmaximizedPos()) + g_settings.set('window-maximized', g_window.isMaximized()) end function exit() diff --git a/modules/client_entergame/characterlist.lua b/modules/client_entergame/characterlist.lua index a72e7dc7..79648077 100644 --- a/modules/client_entergame/characterlist.lua +++ b/modules/client_entergame/characterlist.lua @@ -37,8 +37,8 @@ local function tryLogin(charInfo, tries) end }) -- save last used character - g_settings:set('last-used-character', charInfo.characterName) - g_settings:set('last-used-world', charInfo.worldName) + g_settings.set('last-used-character', charInfo.characterName) + g_settings.set('last-used-world', charInfo.worldName) end local function updateWait(timeStart, timeEnd) @@ -225,7 +225,7 @@ function CharacterList.create(characters, account, otui) connect(widget, { onDoubleClick = function () CharacterList.doLogin() return true end } ) - if i == 1 or (g_settings:get('last-used-character') == widget.characterName and g_settings:get('last-used-world') == widget.worldName) then + if i == 1 or (g_settings.get('last-used-character') == widget.characterName and g_settings.get('last-used-world') == widget.worldName) then focusLabel = widget end end diff --git a/modules/client_entergame/entergame.lua b/modules/client_entergame/entergame.lua index b83e9224..9015f198 100644 --- a/modules/client_entergame/entergame.lua +++ b/modules/client_entergame/entergame.lua @@ -41,13 +41,13 @@ local function onCharacterList(protocol, characters, account, otui) local account = g_crypt.encrypt(G.account) local password = g_crypt.encrypt(G.password) - g_settings:set('account', account) - g_settings:set('password', password) + g_settings.set('account', account) + g_settings.set('password', password) ServerList.setServerAccount(G.host, account) ServerList.setServerPassword(G.host, password) - g_settings:set('autologin', enterGame:getChildById('autoLoginBox'):isChecked()) + g_settings.set('autologin', enterGame:getChildById('autoLoginBox'):isChecked()) else -- reset server list account/password ServerList.setServerAccount(G.host, '') @@ -63,9 +63,9 @@ local function onCharacterList(protocol, characters, account, otui) CharacterList.show() if motdEnabled then - local lastMotdNumber = g_settings:getNumber("motd") + local lastMotdNumber = g_settings.getNumber("motd") if G.motdNumber and G.motdNumber ~= lastMotdNumber then - g_settings:set("motd", motdNumber) + g_settings.set("motd", motdNumber) motdWindow = displayInfoBox(tr('Message of the day'), G.motdMessage) connect(motdWindow, { onOk = function() CharacterList.show() motdWindow = nil end }) CharacterList.hide() @@ -99,12 +99,12 @@ function EnterGame.init() motdButton:show() end - local account = g_settings:get('account') - local password = g_settings:get('password') - local host = g_settings:get('host') - local port = g_settings:get('port') - local autologin = g_settings:getBoolean('autologin') - local clientVersion = g_settings:getInteger('client-version') + local account = g_settings.get('account') + local password = g_settings.get('password') + local host = g_settings.get('host') + local port = g_settings.get('port') + local autologin = g_settings.getBoolean('autologin') + local clientVersion = g_settings.getInteger('client-version') if clientVersion == 0 then clientVersion = 860 end if port == nil or port == 0 then port = 7171 end @@ -132,13 +132,13 @@ end function EnterGame.firstShow() EnterGame.show() - local account = g_crypt.decrypt(g_settings:get('account')) - local password = g_crypt.decrypt(g_settings:get('password')) - local host = g_settings:get('host') - local autologin = g_settings:getBoolean('autologin') + local account = g_crypt.decrypt(g_settings.get('account')) + local password = g_crypt.decrypt(g_settings.get('password')) + local host = g_settings.get('host') + local autologin = g_settings.getBoolean('autologin') if #host > 0 and #password > 0 and #account > 0 and autologin then addEvent(function() - if not g_settings:getBoolean('autologin') then return end + if not g_settings.getBoolean('autologin') then return end EnterGame.doLogin() end) end @@ -205,8 +205,8 @@ function EnterGame.clearAccountFields() enterGame:getChildById('accountNameTextEdit'):clearText() enterGame:getChildById('accountPasswordTextEdit'):clearText() enterGame:getChildById('accountNameTextEdit'):focus() - g_settings:remove('account') - g_settings:remove('password') + g_settings.remove('account') + g_settings.remove('password') end function EnterGame.doLogin() @@ -223,9 +223,9 @@ function EnterGame.doLogin() return end - g_settings:set('host', G.host) - g_settings:set('port', G.port) - g_settings:set('client-version', clientVersion) + g_settings.set('host', G.host) + g_settings.set('port', G.port) + g_settings.set('client-version', clientVersion) protocolLogin = ProtocolLogin.create() protocolLogin.onLoginError = onError diff --git a/modules/client_locales/locales.lua b/modules/client_locales/locales.lua index f3623e80..ecf69966 100644 --- a/modules/client_locales/locales.lua +++ b/modules/client_locales/locales.lua @@ -64,7 +64,7 @@ function init() installLocales('/locales') - local userLocaleName = g_settings:get('locale', 'false') + local userLocaleName = g_settings.get('locale', 'false') if userLocaleName ~= 'false' and setLocale(userLocaleName) then pdebug('Using configured locale: ' .. userLocaleName) else @@ -150,7 +150,7 @@ function setLocale(name) sendLocale(locale.name) end currentLocale = locale - g_settings:set('locale', name) + g_settings.set('locale', name) if onLocaleChanged then onLocaleChanged(name) end return true end diff --git a/modules/client_options/options.lua b/modules/client_options/options.lua index 4ad1a1ad..9ca73fa2 100644 --- a/modules/client_options/options.lua +++ b/modules/client_options/options.lua @@ -84,7 +84,7 @@ end function init() for k,v in pairs(defaultOptions) do - g_settings:setDefault(k, v) + g_settings.setDefault(k, v) options[k] = v end @@ -129,9 +129,9 @@ function setup() -- load options for k,v in pairs(defaultOptions) do if type(v) == 'boolean' then - setOption(k, g_settings:getBoolean(k), true) + setOption(k, g_settings.getBoolean(k), true) elseif type(v) == 'number' then - setOption(k, g_settings:getNumber(k), true) + setOption(k, g_settings.getNumber(k), true) end end end @@ -243,7 +243,7 @@ function setOption(key, value, force) end end - g_settings:set(key, value) + g_settings.set(key, value) options[key] = value end diff --git a/modules/client_serverlist/serverlist.lua b/modules/client_serverlist/serverlist.lua index 7d98ea69..2f084548 100644 --- a/modules/client_serverlist/serverlist.lua +++ b/modules/client_serverlist/serverlist.lua @@ -11,14 +11,14 @@ function ServerList.init() serverListWindow = g_ui.displayUI('serverlist') serverTextList = serverListWindow:getChildById('serverList') - servers = g_settings:getNode('ServerList') or {} + servers = g_settings.getNode('ServerList') or {} ServerList.load() end function ServerList.terminate() ServerList.destroy() - g_settings:setNode('ServerList', servers) + g_settings.setNode('ServerList', servers) ServerList = nil end diff --git a/modules/client_stats/stats.lua b/modules/client_stats/stats.lua index 5f781a83..285ef5aa 100644 --- a/modules/client_stats/stats.lua +++ b/modules/client_stats/stats.lua @@ -8,10 +8,10 @@ sendReportEvent = nil firstReportEvent = nil function initUUID() - UUID = g_settings:getString('report-uuid') + UUID = g_settings.getString('report-uuid') if not UUID or #UUID ~= 36 then UUID = g_crypt.genUUID() - g_settings:set('report-uuid', UUID) + g_settings.set('report-uuid', UUID) end end diff --git a/modules/client_terminal/terminal.lua b/modules/client_terminal/terminal.lua index 8c80a726..6022fd6c 100644 --- a/modules/client_terminal/terminal.lua +++ b/modules/client_terminal/terminal.lua @@ -126,7 +126,7 @@ function init() terminalButton = modules.client_topmenu.addLeftButton('terminalButton', tr('Terminal') .. ' (Ctrl + T)', '/images/topbuttons/terminal', toggle) g_keyboard.bindKeyDown('Ctrl+T', toggle) - commandHistory = g_settings:getList('terminal-history') + commandHistory = g_settings.getList('terminal-history') commandTextEdit = terminalWindow:getChildById('commandTextEdit') g_keyboard.bindKeyPress('Up', function() navigateCommand(1) end, commandTextEdit) @@ -159,7 +159,7 @@ function init() end function terminate() - g_settings:setList('terminal-history', commandHistory) + g_settings.setList('terminal-history', commandHistory) removeEvent(flushEvent) @@ -172,7 +172,7 @@ function terminate() pos = oldPos, poped = poped } - g_settings:setNode('terminal-window', settings) + g_settings.setNode('terminal-window', settings) g_keyboard.unbindKeyDown('Ctrl+T') g_logger.setOnLog(nil) @@ -222,7 +222,7 @@ function toggle() hide() else if not firstShown then - local settings = g_settings:getNode('terminal-window') + local settings = g_settings.getNode('terminal-window') if settings then if settings.size then oldSize = size end if settings.pos then oldPos = settings.pos end diff --git a/modules/corelib/config.lua b/modules/corelib/config.lua index 6497aa34..27037ff1 100644 --- a/modules/corelib/config.lua +++ b/modules/corelib/config.lua @@ -71,6 +71,3 @@ function Config:getColor(key, default) return tocolor(self:get(key, default)) end -function Config:getColor(key, default) - return tocolor(self:get(key, default)) -end diff --git a/modules/corelib/settings.lua b/modules/corelib/settings.lua index 7df26c85..6ef5e43c 100644 --- a/modules/corelib/settings.lua +++ b/modules/corelib/settings.lua @@ -1,4 +1,82 @@ -- @docclass -g_settings = g_configs.getSettings() +g_settings = { + impl = g_configs.getSettings() +} --- Reserved for settings specific functionality \ No newline at end of file +function g_settings.save() + g_settings.impl:save() +end + +function g_settings.setList(key, list) + g_settings.impl:setList(key, list) +end + +function g_settings.getList(key) + g_settings.impl:getList(key) +end + +function g_settings.exists(key) + g_settings.impl:exists(key) +end + +function g_settings.remove(key) + g_settings.impl:remove(key) +end + +function g_settings.setNode(key, node) + g_settings.impl:setNode(key, node) +end + +function g_settings.getNode(key) + g_settings.impl:getNode(key) +end + +function g_settings.mergeNode(key, node) + g_settings.impl:mergeNode(key, node) +end + +-- convenience methods + +function g_settings.set(key, value) + g_settings.impl:set(key, value) +end + +function g_settings.setDefault(key, value) + return g_settings.impl:setDefault(key, value) +end + +function g_settings.get(key, default) + return g_settings.impl:get(key, default) +end + +function g_settings.getString(key, default) + return g_settings.impl:getString(key, default) +end + +function g_settings.getInteger(key, default) + return g_settings.impl:getInteger(key, default) +end + +function g_settings.getNumber(key, default) + return g_settings.impl:getNumber(key, default) +end + +function g_settings.getBoolean(key, default) + return g_settings.impl:getBoolean(key, default) +end + +function g_settings.getPoint(key, default) + return g_settings.impl:getPoint(key, default) +end + +function g_settings.getRect(key, default) + return g_settings.impl:getRect(key, default) +end + +function g_settings.getSize(key, default) + return g_settings.impl:getSize(key, default) +end + +function g_settings.getColor(key, default) + return g_settings.impl:getColor(key, default) +end diff --git a/modules/corelib/ui/uiminiwindow.lua b/modules/corelib/ui/uiminiwindow.lua index 429fab60..c46511d9 100644 --- a/modules/corelib/ui/uiminiwindow.lua +++ b/modules/corelib/ui/uiminiwindow.lua @@ -93,7 +93,7 @@ function UIMiniWindow:setup() local oldParent = self:getParent() - local settings = g_settings:getNode('MiniWindows') + local settings = g_settings.getNode('MiniWindows') if settings then local selfSettings = settings[self:getId()] if selfSettings then @@ -245,7 +245,7 @@ end function UIMiniWindow:getSettings(name) if not self.save then return nil end - local settings = g_settings:getNode('MiniWindows') + local settings = g_settings.getNode('MiniWindows') if settings then local selfSettings = settings[self:getId()] if selfSettings then @@ -258,7 +258,7 @@ end function UIMiniWindow:setSettings(data) if not self.save then return end - local settings = g_settings:getNode('MiniWindows') + local settings = g_settings.getNode('MiniWindows') if not settings then settings = {} end @@ -272,13 +272,13 @@ function UIMiniWindow:setSettings(data) settings[id][key] = value end - g_settings:setNode('MiniWindows', settings) + g_settings.setNode('MiniWindows', settings) end function UIMiniWindow:eraseSettings(data) if not self.save then return end - local settings = g_settings:getNode('MiniWindows') + local settings = g_settings.getNode('MiniWindows') if not settings then settings = {} end @@ -292,7 +292,7 @@ function UIMiniWindow:eraseSettings(data) settings[id][key] = nil end - g_settings:setNode('MiniWindows', settings) + g_settings.setNode('MiniWindows', settings) end function UIMiniWindow:saveParent(parent) diff --git a/modules/game_battle/battle.lua b/modules/game_battle/battle.lua index bf91bc66..6ea6ef7d 100644 --- a/modules/game_battle/battle.lua +++ b/modules/game_battle/battle.lua @@ -131,7 +131,7 @@ function onMiniWindowClose() end function getSortType() - local settings = g_settings:getNode('BattleList') + local settings = g_settings.getNode('BattleList') if not settings then return 'name' end @@ -141,13 +141,13 @@ end function setSortType(state) settings = {} settings['sortType'] = state - g_settings:mergeNode('BattleList', settings) + g_settings.mergeNode('BattleList', settings) checkCreatures() end function getSortOrder() - local settings = g_settings:getNode('BattleList') + local settings = g_settings.getNode('BattleList') if not settings then return 'asc' end @@ -157,7 +157,7 @@ end function setSortOrder(state) settings = {} settings['sortOrder'] = state - g_settings:mergeNode('BattleList', settings) + g_settings.mergeNode('BattleList', settings) checkCreatures() end @@ -171,7 +171,7 @@ function isSortDesc() end function isHidingFilters() - local settings = g_settings:getNode('BattleList') + local settings = g_settings.getNode('BattleList') if not settings then return false end @@ -181,7 +181,7 @@ end function setHidingFilters(state) settings = {} settings['hidingFilters'] = state - g_settings:mergeNode('BattleList', settings) + g_settings.mergeNode('BattleList', settings) end function hideFilterPanel() diff --git a/modules/game_combatcontrols/combatcontrols.lua b/modules/game_combatcontrols/combatcontrols.lua index 7a95fb2f..85b4d02f 100644 --- a/modules/game_combatcontrols/combatcontrols.lua +++ b/modules/game_combatcontrols/combatcontrols.lua @@ -134,7 +134,7 @@ function online() if player then local char = g_game.getCharacterName() - local lastCombatControls = g_settings:getNode('LastCombatControls') + local lastCombatControls = g_settings.getNode('LastCombatControls') if not table.empty(lastCombatControls) then if lastCombatControls[char] then @@ -167,7 +167,7 @@ function online() end function offline() - local lastCombatControls = g_settings:getNode('LastCombatControls') + local lastCombatControls = g_settings.getNode('LastCombatControls') if not lastCombatControls then lastCombatControls = {} end @@ -186,7 +186,7 @@ function offline() end -- save last combat control settings - g_settings:setNode('LastCombatControls', lastCombatControls) + g_settings.setNode('LastCombatControls', lastCombatControls) end end diff --git a/modules/game_console/console.lua b/modules/game_console/console.lua index 2362d0bd..924c4bf5 100644 --- a/modules/game_console/console.lua +++ b/modules/game_console/console.lua @@ -242,11 +242,11 @@ end function save() local settings = {} settings.messageHistory = messageHistory - g_settings:setNode('game_console', settings) + g_settings.setNode('game_console', settings) end function load() - local settings = g_settings:getNode('game_console') + local settings = g_settings.getNode('game_console') if settings then messageHistory = settings.messageHistory or {} end @@ -263,7 +263,7 @@ end function clear() -- save last open channels - local lastChannelsOpen = g_settings:getNode('lastChannelsOpen') or {} + local lastChannelsOpen = g_settings.getNode('lastChannelsOpen') or {} local char = g_game.getCharacterName() local savedChannels = {} local set = false @@ -278,7 +278,7 @@ function clear() else lastChannelsOpen[char] = nil end - g_settings:setNode('lastChannelsOpen', lastChannelsOpen) + g_settings.setNode('lastChannelsOpen', lastChannelsOpen) -- close channels for _, channelName in pairs(channels) do @@ -1018,25 +1018,25 @@ function loadCommunicationSettings() communicationSettings.whitelistedPlayers = {} communicationSettings.ignoredPlayers = {} - local ignoreNode = g_settings:getNode('IgnorePlayers') + local ignoreNode = g_settings.getNode('IgnorePlayers') if ignoreNode then for i = 1, #ignoreNode do table.insert(communicationSettings.ignoredPlayers, ignoreNode[i]) end end - local whitelistNode = g_settings:getNode('WhitelistedPlayers') + local whitelistNode = g_settings.getNode('WhitelistedPlayers') if whitelistNode then for i = 1, #whitelistNode do table.insert(communicationSettings.whitelistedPlayers, whitelistNode[i]) end end - communicationSettings.useIgnoreList = g_settings:getBoolean('UseIgnoreList') - communicationSettings.useWhiteList = g_settings:getBoolean('UseWhiteList') - communicationSettings.privateMessages = g_settings:getBoolean('IgnorePrivateMessages') - communicationSettings.yelling = g_settings:getBoolean('IgnoreYelling') - communicationSettings.allowVIPs = g_settings:getBoolean('AllowVIPs') + communicationSettings.useIgnoreList = g_settings.getBoolean('UseIgnoreList') + communicationSettings.useWhiteList = g_settings.getBoolean('UseWhiteList') + communicationSettings.privateMessages = g_settings.getBoolean('IgnorePrivateMessages') + communicationSettings.yelling = g_settings.getBoolean('IgnoreYelling') + communicationSettings.allowVIPs = g_settings.getBoolean('AllowVIPs') end function saveCommunicationSettings() @@ -1052,12 +1052,12 @@ function saveCommunicationSettings() table.insert(tmpWhiteList, whitelistedPlayers[i]) end - g_settings:set('UseIgnoreList', communicationSettings.useIgnoreList) - g_settings:set('UseWhiteList', communicationSettings.useWhiteList) - g_settings:set('IgnorePrivateMessages', communicationSettings.privateMessages) - g_settings:set('IgnoreYelling', communicationSettings.yelling) - g_settings:setNode('IgnorePlayers', tmpIgnoreList) - g_settings:setNode('WhitelistedPlayers', tmpWhiteList) + g_settings.set('UseIgnoreList', communicationSettings.useIgnoreList) + g_settings.set('UseWhiteList', communicationSettings.useWhiteList) + g_settings.set('IgnorePrivateMessages', communicationSettings.privateMessages) + g_settings.set('IgnoreYelling', communicationSettings.yelling) + g_settings.setNode('IgnorePlayers', tmpIgnoreList) + g_settings.setNode('WhitelistedPlayers', tmpWhiteList) end function getIgnoredPlayers() @@ -1240,7 +1240,7 @@ function online() g_keyboard.bindKeyDown('Ctrl+R', openPlayerReportRuleViolationWindow) end -- open last channels - local lastChannelsOpen = g_settings:getNode('lastChannelsOpen') + local lastChannelsOpen = g_settings.getNode('lastChannelsOpen') if lastChannelsOpen then local savedChannels = lastChannelsOpen[g_game.getCharacterName()] if savedChannels then diff --git a/modules/game_hotkeys/hotkeys_manager.lua b/modules/game_hotkeys/hotkeys_manager.lua index 945bfb34..d76c59c8 100644 --- a/modules/game_hotkeys/hotkeys_manager.lua +++ b/modules/game_hotkeys/hotkeys_manager.lua @@ -145,7 +145,7 @@ end function load(forceDefaults) hotkeysManagerLoaded = false - local hotkeySettings = g_settings:getNode('game_hotkeys') + local hotkeySettings = g_settings.getNode('game_hotkeys') local hotkeys = {} if not table.empty(hotkeySettings) then hotkeys = hotkeySettings end @@ -192,7 +192,7 @@ function reload() end function save() - local hotkeySettings = g_settings:getNode('game_hotkeys') or {} + local hotkeySettings = g_settings.getNode('game_hotkeys') or {} local hotkeys = hotkeySettings if perServer then @@ -223,8 +223,8 @@ function save() end hotkeyList = hotkeys - g_settings:setNode('game_hotkeys', hotkeySettings) - g_settings:save() + g_settings.setNode('game_hotkeys', hotkeySettings) + g_settings.save() end function loadDefautComboKeys() diff --git a/modules/game_interface/gameinterface.lua b/modules/game_interface/gameinterface.lua index 51291248..9c45a65b 100644 --- a/modules/game_interface/gameinterface.lua +++ b/modules/game_interface/gameinterface.lua @@ -178,11 +178,11 @@ end function save() local settings = {} settings.splitterMarginBottom = bottomSplitter:getMarginBottom() - g_settings:setNode('game_interface', settings) + g_settings.setNode('game_interface', settings) end function load() - local settings = g_settings:getNode('game_interface') + local settings = g_settings.getNode('game_interface') if settings then if settings.splitterMarginBottom then bottomSplitter:setMarginBottom(settings.splitterMarginBottom) diff --git a/modules/game_viplist/viplist.lua b/modules/game_viplist/viplist.lua index 72daeeda..213318fb 100644 --- a/modules/game_viplist/viplist.lua +++ b/modules/game_viplist/viplist.lua @@ -48,7 +48,7 @@ function terminate() end function loadVipInfo() - local settings = g_settings:getNode('VipList') + local settings = g_settings.getNode('VipList') if not settings then vipInfo = {} return @@ -59,7 +59,7 @@ end function saveVipInfo() settings = {} settings['VipInfo'] = vipInfo - g_settings:mergeNode('VipList', settings) + g_settings.mergeNode('VipList', settings) end @@ -212,13 +212,13 @@ end function hideOffline(state) settings = {} settings['hideOffline'] = state - g_settings:mergeNode('VipList', settings) + g_settings.mergeNode('VipList', settings) refresh() end function isHiddingOffline() - local settings = g_settings:getNode('VipList') + local settings = g_settings.getNode('VipList') if not settings then return false end @@ -226,7 +226,7 @@ function isHiddingOffline() end function getSortedBy() - local settings = g_settings:getNode('VipList') + local settings = g_settings.getNode('VipList') if not settings or not settings['sortedBy'] then return 'status' end @@ -236,7 +236,7 @@ end function sortBy(state) settings = {} settings['sortedBy'] = state - g_settings:mergeNode('VipList', settings) + g_settings.mergeNode('VipList', settings) refresh() end diff --git a/modules/gamelib/ui/uiminimap.lua b/modules/gamelib/ui/uiminimap.lua index 1cbfa4d8..1a3a4f2b 100644 --- a/modules/gamelib/ui/uiminimap.lua +++ b/modules/gamelib/ui/uiminimap.lua @@ -55,7 +55,7 @@ function UIMinimap:disableAutoWalk() end function UIMinimap:load() - local settings = g_settings:getNode('Minimap') + local settings = g_settings.getNode('Minimap') if settings then if settings.flags then for _,flag in pairs(settings.flags) do @@ -76,7 +76,7 @@ function UIMinimap:save() }) end settings.zoom = self:getZoom() - g_settings:setNode('Minimap', settings) + g_settings.setNode('Minimap', settings) end local function onFlagMouseRelease(widget, pos, button)