From d8290561d59a960ddcf9dbe27570d33d9124e528 Mon Sep 17 00:00:00 2001
From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54>
Date: Sun, 25 Mar 2012 14:13:31 +0000
Subject: [PATCH] New option in the main menu: reset interface positions

git-svn-id: http://svn.net-core.org/repos/t-engine4@4994 51575b47-30f0-44d4-a5cc-537603b46e54
---
 game/modules/tome/class/Game.lua             | 5 ++++-
 game/modules/tome/class/uiset/Minimalist.lua | 6 ++++++
 game/modules/tome/class/uiset/UISet.lua      | 4 ++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua
index 370ef7eee2..8fc77a8af0 100644
--- a/game/modules/tome/class/Game.lua
+++ b/game/modules/tome/class/Game.lua
@@ -1353,7 +1353,7 @@ function _M:setupCommands()
 
 		HELP = "EXIT",
 		EXIT = function()
-			local menu menu = require("engine.dialogs.GameMenu").new{
+			local l = {
 				"resume",
 				"achievements",
 				{ "Show known Lore", function() self:unregisterDialog(menu) self:registerDialog(require("mod.dialogs.ShowLore").new("Tales of Maj'Eyal Lore", self.player)) end },
@@ -1368,6 +1368,9 @@ function _M:setupCommands()
 				"save",
 				"quit"
 			}
+			local adds = self.uiset:getMainMenuItems()
+			for i = #adds, 1, -1 do table.insert(l, 10, adds[i]) end
+			local menu menu = require("engine.dialogs.GameMenu").new(l)
 			self:registerDialog(menu)
 		end,
 
diff --git a/game/modules/tome/class/uiset/Minimalist.lua b/game/modules/tome/class/uiset/Minimalist.lua
index cb3058f559..f53e2ad6df 100644
--- a/game/modules/tome/class/uiset/Minimalist.lua
+++ b/game/modules/tome/class/uiset/Minimalist.lua
@@ -210,6 +210,12 @@ function _M:init()
 	self.buffs_base = UI:makeFrame("ui/icon-frame/frame", 40, 40)
 end
 
+function _M:getMainMenuItems()
+	return {
+		{"Reset interface positions", function() self:resetPlaces() end},
+	}
+end
+
 --- Forbid some options from showing up, they are useless for this ui
 function _M:checkGameOption(name)
 	local list = table.reverse{"icons_temp_effects", "icons_hotkeys", "hotkeys_rows", "log_lines"}
diff --git a/game/modules/tome/class/uiset/UISet.lua b/game/modules/tome/class/uiset/UISet.lua
index 40b42c6160..3fcc518138 100644
--- a/game/modules/tome/class/uiset/UISet.lua
+++ b/game/modules/tome/class/uiset/UISet.lua
@@ -54,3 +54,7 @@ end
 function _M:handleResolutionChange(w, h, ow, oh)
 	return false
 end
+
+function _M:getMainMenuItems()
+	return {}
+end
-- 
GitLab