From 914b4bd5f3aaff0a1477d7e37080775a616b85ee Mon Sep 17 00:00:00 2001 From: BeniS Date: Fri, 11 Jan 2013 17:03:48 +1300 Subject: [PATCH] Applied #189 * There was a bug in OTML saving hotkeys per player because of the way they are storing children and not a straight value. Perhaps you want to look at it ed. Note: Your hotkeys will reset in this revision. --- modules/game_hotkeys/hotkeys_manager.lua | 36 +++++++++++++++--------- src/framework/otml/otmlemitter.cpp | 2 +- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/modules/game_hotkeys/hotkeys_manager.lua b/modules/game_hotkeys/hotkeys_manager.lua index 2a63d8a8..6d282131 100644 --- a/modules/game_hotkeys/hotkeys_manager.lua +++ b/modules/game_hotkeys/hotkeys_manager.lua @@ -84,13 +84,16 @@ function terminate() end function load() - local hotkeySettings = g_settings.getNode('HotkeysManager') - - local hasCombos = false - if hotkeySettings ~= nil then - for i, v in pairs(hotkeySettings) do - addKeyCombo(nil, v.keyCombo, v) - hasCombos = true + local hotkeySettings = g_settings.getNode('HotkeysManager') or {} + if hotkeySettings then + local playerHotkeySettings = hotkeySettings[g_game.getLocalPlayer():getName()] + + local hasCombos = false + if playerHotkeySettings ~= nil then + for k, setting in pairs(playerHotkeySettings) do + addKeyCombo(nil, setting.keyCombo, setting) + hasCombos = true + end end end @@ -99,18 +102,25 @@ function load() for i=1,12 do addKeyCombo(nil, 'F' .. i) end + for i=1,4 do + addKeyCombo(nil, 'Shift+F' .. i) + end end end function save() - local hotkeySettings = {} + local char = g_game.getLocalPlayer():getName() + local hotkeySettings = g_settings.getNode('HotkeysManager') or {} + hotkeySettings[char] = {} for i=1, currentHotkeysList:getChildCount() do local child = currentHotkeysList:getChildByIndex(i) - table.insert(hotkeySettings, {keyCombo = child.keyCombo, - autoSend = child.autoSend, - itemId = child.itemId, - useType = child.useType, - value = child.value}) + table.insert(hotkeySettings[char], { + keyCombo = child.keyCombo, + autoSend = child.autoSend, + itemId = child.itemId, + useType = child.useType, + value = child.value + }) end g_settings.setNode('HotkeysManager', hotkeySettings) diff --git a/src/framework/otml/otmlemitter.cpp b/src/framework/otml/otmlemitter.cpp index 4f08b89c..6ac8ad17 100644 --- a/src/framework/otml/otmlemitter.cpp +++ b/src/framework/otml/otmlemitter.cpp @@ -38,7 +38,7 @@ std::string OTMLEmitter::emitNode(const OTMLNodePtr& node, int currentDepth) ss << node->tag(); // add ':' to if the node is unique or has value - if(node->hasValue() || node->isUnique() || node->isNull()) + if(node->hasValue() || node->isUnique() || node->isNull() || node->hasChildren()) ss << ":"; } else ss << "-";