From 577fba6fd96b6dbe6c290847d32e5366bb1c4f0f Mon Sep 17 00:00:00 2001 From: dg <dg@51575b47-30f0-44d4-a5cc-537603b46e54> Date: Mon, 20 Sep 2010 22:30:55 +0000 Subject: [PATCH] All dialogs now are restricted to react on click, not on mouse move git-svn-id: http://svn.net-core.org/repos/t-engine4@1265 51575b47-30f0-44d4-a5cc-537603b46e54 --- game/engines/default/engine/dialogs/Chat.lua | 6 +++--- .../default/engine/dialogs/DisplayResolution.lua | 6 +++--- game/engines/default/engine/dialogs/GameMenu.lua | 6 +++--- game/engines/default/engine/dialogs/ShowEquipInven.lua | 6 +++--- game/engines/default/engine/dialogs/ShowEquipment.lua | 6 +++--- game/engines/default/engine/dialogs/ShowInventory.lua | 6 +++--- .../engines/default/engine/dialogs/ShowPickupFloor.lua | 6 +++--- game/engines/default/engine/dialogs/ShowQuests.lua | 6 +++--- game/engines/default/engine/dialogs/ShowStore.lua | 6 +++--- game/engines/default/engine/dialogs/SoundMusic.lua | 6 +++--- game/engines/default/engine/dialogs/UseTalents.lua | 6 +++--- .../engines/default/engine/interface/GameTargeting.lua | 8 ++++---- game/modules/example/class/Game.lua | 10 +++++----- game/modules/example_realtime/class/Game.lua | 10 +++++----- game/modules/tome/class/Game.lua | 2 +- game/modules/tome/dialogs/DeathDialog.lua | 4 ++-- game/modules/tome/dialogs/GraphicMode.lua | 6 +++--- game/modules/tome/dialogs/LevelupStatsDialog.lua | 6 +++--- game/modules/tome/dialogs/LevelupTalentsDialog.lua | 6 +++--- game/modules/tome/dialogs/MapMenu.lua | 4 ++-- game/modules/tome/dialogs/UseItemDialog.lua | 4 ++-- 21 files changed, 63 insertions(+), 63 deletions(-) diff --git a/game/engines/default/engine/dialogs/Chat.lua b/game/engines/default/engine/dialogs/Chat.lua index 389cc37476..d3e8e460c4 100644 --- a/game/engines/default/engine/dialogs/Chat.lua +++ b/game/engines/default/engine/dialogs/Chat.lua @@ -48,13 +48,13 @@ function _M:init(chat, id) ACCEPT = function() self:use() end, }) self:mouseZones{ - { x=0, y=0, w=self.w, h=self.h, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=0, y=0, w=self.w, h=self.h, fct=function(button, x, y, xrel, yrel, tx, ty, event) if self.start_answer_y and y >= self.start_answer_y then ty = ty - self.start_answer_y self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list) self.changed = true - if button == "left" then self:use() - elseif button == "right" then + if button == "left" and event == "button" then self:use() + elseif button == "right" and event == "button" then end end end }, diff --git a/game/engines/default/engine/dialogs/DisplayResolution.lua b/game/engines/default/engine/dialogs/DisplayResolution.lua index 040e41fe5e..8c7427b3be 100644 --- a/game/engines/default/engine/dialogs/DisplayResolution.lua +++ b/game/engines/default/engine/dialogs/DisplayResolution.lua @@ -46,11 +46,11 @@ function _M:init() }) self:mouseZones{ { x=0, y=0, w=game.w, h=game.h, mode={button=true}, norestrict=true, fct=function(button) if button ~= "none" then game:unregisterDialog(self) end end}, - { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty, event) self.changed = true self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list) - if button == "left" then self:use() - elseif button == "right" then + if button == "left" and event == "button" then self:use() + elseif button == "right" and event == "button" then end end }, } diff --git a/game/engines/default/engine/dialogs/GameMenu.lua b/game/engines/default/engine/dialogs/GameMenu.lua index 2ad3783ccd..d369a690e6 100644 --- a/game/engines/default/engine/dialogs/GameMenu.lua +++ b/game/engines/default/engine/dialogs/GameMenu.lua @@ -47,11 +47,11 @@ function _M:init(actions) }) self:mouseZones{ { x=0, y=0, w=game.w, h=game.h, mode={button=true}, norestrict=true, fct=function(button) if button ~= "none" then game:unregisterDialog(self) end end}, - { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty, event) self.changed = true self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list) - if button == "left" then self:use() - elseif button == "right" then + if button == "left" and event == "button" then self:use() + elseif button == "right" and event == "button" then end end }, } diff --git a/game/engines/default/engine/dialogs/ShowEquipInven.lua b/game/engines/default/engine/dialogs/ShowEquipInven.lua index eaeffaa3d8..84bf762fcb 100644 --- a/game/engines/default/engine/dialogs/ShowEquipInven.lua +++ b/game/engines/default/engine/dialogs/ShowEquipInven.lua @@ -90,7 +90,7 @@ function _M:init(title, actor, filter, action) }) self:mouseZones{ { x=0, y=0, w=game.w, h=game.h, mode={button=true}, norestrict=true, fct=function(button) if button ~= "none" then game:unregisterDialog(self) end end}, - { x=2, y=5, w=self.iw, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=2, y=5, w=self.iw, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty, event) if tx < self.iw / 2 then self.list = self.equip_list else @@ -99,8 +99,8 @@ function _M:init(title, actor, filter, action) self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list) self.changed = true - if button == "left" then self:use() - elseif button == "right" then + if button == "left" and event == "button" then self:use() + elseif button == "right" and event == "button" then end end }, } diff --git a/game/engines/default/engine/dialogs/ShowEquipment.lua b/game/engines/default/engine/dialogs/ShowEquipment.lua index 92cc6d1464..8c334de0f4 100644 --- a/game/engines/default/engine/dialogs/ShowEquipment.lua +++ b/game/engines/default/engine/dialogs/ShowEquipment.lua @@ -49,11 +49,11 @@ function _M:init(title, actor, filter, action) }) self:mouseZones{ { x=0, y=0, w=game.w, h=game.h, mode={button=true}, norestrict=true, fct=function(button) if button ~= "none" then game:unregisterDialog(self) end end}, - { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty, event) self.changed = true self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list) - if button == "left" then self:use() - elseif button == "right" then + if button == "left" and event == "button" then self:use() + elseif button == "right" and event == "button" then end end }, } diff --git a/game/engines/default/engine/dialogs/ShowInventory.lua b/game/engines/default/engine/dialogs/ShowInventory.lua index 4fdb8ccac0..5e2180ee32 100644 --- a/game/engines/default/engine/dialogs/ShowInventory.lua +++ b/game/engines/default/engine/dialogs/ShowInventory.lua @@ -87,11 +87,11 @@ function _M:init(title, inven, filter, action, actor) }) self:mouseZones{ { x=0, y=0, w=game.w, h=game.h, mode={button=true}, norestrict=true, fct=function(button) if button ~= "none" then game:unregisterDialog(self) end end}, - { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty, event) self.changed = true self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list) - if button == "left" then self:use() - elseif button == "right" then + if button == "left" and event == "button" then self:use() + elseif button == "right" and event == "button" then end end }, } diff --git a/game/engines/default/engine/dialogs/ShowPickupFloor.lua b/game/engines/default/engine/dialogs/ShowPickupFloor.lua index 3b1304c697..02b16235f6 100644 --- a/game/engines/default/engine/dialogs/ShowPickupFloor.lua +++ b/game/engines/default/engine/dialogs/ShowPickupFloor.lua @@ -50,11 +50,11 @@ function _M:init(title, x, y, filter, action) }) self:mouseZones{ { x=0, y=0, w=game.w, h=game.h, mode={button=true}, norestrict=true, fct=function(button) if button ~= "none" then game:unregisterDialog(self) end end}, - { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty, event) self.changed = true self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list) - if button == "left" then self:use() - elseif button == "right" then + if button == "left" and event == "button" then self:use() + elseif button == "right" and event == "button" then end end }, } diff --git a/game/engines/default/engine/dialogs/ShowQuests.lua b/game/engines/default/engine/dialogs/ShowQuests.lua index 3a7d0b5585..d056e59c2f 100644 --- a/game/engines/default/engine/dialogs/ShowQuests.lua +++ b/game/engines/default/engine/dialogs/ShowQuests.lua @@ -48,11 +48,11 @@ function _M:init(actor) }) self:mouseZones{ { x=0, y=0, w=game.w, h=game.h, mode={button=true}, norestrict=true, fct=function(button) if button ~= "none" then game:unregisterDialog(self) end end}, - { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty, event) self.changed = true self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list) - if button == "left" then - elseif button == "right" then + if button == "left" and event == "button" then + elseif button == "right" and event == "button" then end end }, } diff --git a/game/engines/default/engine/dialogs/ShowStore.lua b/game/engines/default/engine/dialogs/ShowStore.lua index 5bc7dd2456..519988da96 100644 --- a/game/engines/default/engine/dialogs/ShowStore.lua +++ b/game/engines/default/engine/dialogs/ShowStore.lua @@ -55,7 +55,7 @@ function _M:init(title, store_inven, actor_inven, store_filter, actor_filter, ac }) self:mouseZones{ { x=0, y=0, w=game.w, h=game.h, mode={button=true}, norestrict=true, fct=function(button) if button ~= "none" then game:unregisterDialog(self) end end}, - { x=2, y=5, w=self.iw, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=2, y=5, w=self.iw, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty, event) if tx < self.iw / 2 then self.list = self.store_list else @@ -63,8 +63,8 @@ function _M:init(title, store_inven, actor_inven, store_filter, actor_filter, ac end self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list) self.changed = true - if button == "left" then self:use() - elseif button == "right" then + if button == "left" and event == "button" then self:use() + elseif button == "right" and event == "button" then end end }, } diff --git a/game/engines/default/engine/dialogs/SoundMusic.lua b/game/engines/default/engine/dialogs/SoundMusic.lua index 9a5e0a85eb..5b98e100b9 100644 --- a/game/engines/default/engine/dialogs/SoundMusic.lua +++ b/game/engines/default/engine/dialogs/SoundMusic.lua @@ -48,11 +48,11 @@ function _M:init() }) self:mouseZones{ { x=0, y=0, w=game.w, h=game.h, mode={button=true}, norestrict=true, fct=function(button) if button ~= "none" then game:unregisterDialog(self) end end}, - { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty, event) self.changed = true self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list) - if button == "left" then self:use(true) - elseif button == "right" then self:use(false) + if button == "left" and event == "button" then self:use(true) + elseif button == "right" and event == "button" then self:use(false) end end }, } diff --git a/game/engines/default/engine/dialogs/UseTalents.lua b/game/engines/default/engine/dialogs/UseTalents.lua index ab44a2402f..7b9a1e2c2d 100644 --- a/game/engines/default/engine/dialogs/UseTalents.lua +++ b/game/engines/default/engine/dialogs/UseTalents.lua @@ -87,11 +87,11 @@ function _M:init(actor) }) self:mouseZones{ { x=0, y=0, w=game.w, h=game.h, mode={button=true}, norestrict=true, fct=function(button) if button ~= "none" then game:unregisterDialog(self) end end}, - { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty, event) self.changed = true self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list) - if button == "left" then self:use() - elseif button == "right" then + if button == "left" and event == "button" then self:use() + elseif button == "right" and event == "button" then end end }, } diff --git a/game/engines/default/engine/interface/GameTargeting.lua b/game/engines/default/engine/interface/GameTargeting.lua index 8d7b6c7167..983b7c9baa 100644 --- a/game/engines/default/engine/interface/GameTargeting.lua +++ b/game/engines/default/engine/interface/GameTargeting.lua @@ -171,21 +171,21 @@ end --- Handle mouse event for targeting -- @return true if the event was handled -function _M:targetMouse(button, mx, my, xrel, yrel) +function _M:targetMouse(button, mx, my, xrel, yrel, event) -- Move tooltip self.tooltip_x, self.tooltip_y = mx, my local tmx, tmy = self.level.map:getMouseTile(mx, my) if self.key == self.targetmode_key then -- Target with mouse - if button == "none" and xrel and yrel then + if button == "none" and xrel and yrel and event == "motion" then self.target:setSpot(tmx, tmy) -- Accept target - elseif button == "left" and not xrel and not yrel then + elseif button == "left" and not xrel and not yrel and event == "button" then self:targetMode(false, false) self.tooltip_x, self.tooltip_y = nil, nil -- Cancel target - elseif not xrel and not yrel then + elseif not xrel and not yrel and event == "button" then self.target.target.entity = nil self.target.target.x = nil self.target.target.y = nil diff --git a/game/modules/example/class/Game.lua b/game/modules/example/class/Game.lua index f3241970b2..8fcae4f05b 100644 --- a/game/modules/example/class/Game.lua +++ b/game/modules/example/class/Game.lua @@ -385,12 +385,12 @@ end function _M:setupMouse(reset) if reset then self.mouse:reset() end - self.mouse:registerZone(Map.display_x, Map.display_y, Map.viewport.width, Map.viewport.height, function(button, mx, my, xrel, yrel) + self.mouse:registerZone(Map.display_x, Map.display_y, Map.viewport.width, Map.viewport.height, function(button, mx, my, xrel, yrel, bx, by, event) -- Handle targeting - if self:targetMouse(button, mx, my, xrel, yrel) then return end + if self:targetMouse(button, mx, my, xrel, yrel, event) then return end -- Handle the mouse movement/scrolling - self.player:mouseHandleDefault(self.key, self.key == self.normal_key, button, mx, my, xrel, yrel) + self.player:mouseHandleDefault(self.key, self.key == self.normal_key, button, mx, my, xrel, yrel, event) end) -- Scroll message log self.mouse:registerZone(self.logdisplay.display_x, self.logdisplay.display_y, self.w, self.h, function(button) @@ -398,8 +398,8 @@ function _M:setupMouse(reset) if button == "wheeldown" then self.logdisplay:scrollUp(-1) end end, {button=true}) -- Use hotkeys with mouse - self.mouse:registerZone(self.hotkeys_display.display_x, self.hotkeys_display.display_y, self.w, self.h, function(button, mx, my, xrel, yrel) - self.hotkeys_display:onMouse(button, mx, my, not xrel) + self.mouse:registerZone(self.hotkeys_display.display_x, self.hotkeys_display.display_y, self.w, self.h, function(button, mx, my, xrel, yrel, bx, by, event) + self.hotkeys_display:onMouse(button, mx, my, event == "button", function(text) self.tooltip:displayAtMap(nil, nil, self.w, self.h, text) end) end) self.mouse:setCurrent() end diff --git a/game/modules/example_realtime/class/Game.lua b/game/modules/example_realtime/class/Game.lua index 4b8f2cd6bf..f903724148 100644 --- a/game/modules/example_realtime/class/Game.lua +++ b/game/modules/example_realtime/class/Game.lua @@ -384,12 +384,12 @@ end function _M:setupMouse(reset) if reset then self.mouse:reset() end - self.mouse:registerZone(Map.display_x, Map.display_y, Map.viewport.width, Map.viewport.height, function(button, mx, my, xrel, yrel) + self.mouse:registerZone(Map.display_x, Map.display_y, Map.viewport.width, Map.viewport.height, function(button, mx, my, xrel, yrel, bx, by, event) -- Handle targeting - if self:targetMouse(button, mx, my, xrel, yrel) then return end + if self:targetMouse(button, mx, my, xrel, yrel, event) then return end -- Handle the mouse movement/scrolling - self.player:mouseHandleDefault(self.key, self.key == self.normal_key, button, mx, my, xrel, yrel) + self.player:mouseHandleDefault(self.key, self.key == self.normal_key, button, mx, my, xrel, yrel, event) end) -- Scroll message log self.mouse:registerZone(self.logdisplay.display_x, self.logdisplay.display_y, self.w, self.h, function(button) @@ -397,8 +397,8 @@ function _M:setupMouse(reset) if button == "wheeldown" then self.logdisplay:scrollUp(-1) end end, {button=true}) -- Use hotkeys with mouse - self.mouse:registerZone(self.hotkeys_display.display_x, self.hotkeys_display.display_y, self.w, self.h, function(button, mx, my, xrel, yrel) - self.hotkeys_display:onMouse(button, mx, my, not xrel) + self.mouse:registerZone(self.hotkeys_display.display_x, self.hotkeys_display.display_y, self.w, self.h, function(button, mx, my, xrel, yrel, bx, by, event) + self.hotkeys_display:onMouse(button, mx, my, event == "button", function(text) self.tooltip:displayAtMap(nil, nil, self.w, self.h, text) end) end) self.mouse:setCurrent() end diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index 0ae079a7f1..bc388b2ff5 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -768,7 +768,7 @@ function _M:setupMouse(reset) if reset then self.mouse:reset() end self.mouse:registerZone(Map.display_x, Map.display_y, Map.viewport.width, Map.viewport.height, function(button, mx, my, xrel, yrel, bx, by, event) -- Handle targeting - if self:targetMouse(button, mx, my, xrel, yrel) then return end + if self:targetMouse(button, mx, my, xrel, yrel, event) then return end -- Handle Use menu if button == "right" and not xrel and not yrel and event == "button" then self:mouseRightClick(mx, my) return end diff --git a/game/modules/tome/dialogs/DeathDialog.lua b/game/modules/tome/dialogs/DeathDialog.lua index 8df5444fa7..7ba50820c9 100644 --- a/game/modules/tome/dialogs/DeathDialog.lua +++ b/game/modules/tome/dialogs/DeathDialog.lua @@ -40,10 +40,10 @@ function _M:init(actor) ACCEPT = function() self:use() end, }) self:mouseZones{ - { x=2, y=10 + self.font:lineSkip()*6, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=2, y=10 + self.font:lineSkip()*6, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty, event) self.changed = true self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list) - if button == "left" then self:use() + if button == "left" and event == "button" then self:use() end end }, } diff --git a/game/modules/tome/dialogs/GraphicMode.lua b/game/modules/tome/dialogs/GraphicMode.lua index 9e99db3178..24072008a0 100644 --- a/game/modules/tome/dialogs/GraphicMode.lua +++ b/game/modules/tome/dialogs/GraphicMode.lua @@ -46,11 +46,11 @@ function _M:init() }) self:mouseZones{ { x=0, y=0, w=game.w, h=game.h, mode={button=true}, norestrict=true, fct=function(button) if button ~= "none" then game:unregisterDialog(self) end end}, - { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=2, y=5, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty, event) self.changed = true self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list) - if button == "left" then self:use() - elseif button == "right" then + if button == "left" and event == "button" then self:use() + elseif button == "right" and event == "button" then end end }, } diff --git a/game/modules/tome/dialogs/LevelupStatsDialog.lua b/game/modules/tome/dialogs/LevelupStatsDialog.lua index 33357b5d79..242073a007 100644 --- a/game/modules/tome/dialogs/LevelupStatsDialog.lua +++ b/game/modules/tome/dialogs/LevelupStatsDialog.lua @@ -51,11 +51,11 @@ function _M:init(actor, on_finish) }) self:mouseZones{ { x=0, y=0, w=game.w, h=game.h, mode={button=true}, norestrict=true, fct=function(button) if button ~= "none" then self.key:triggerVirtual("EXIT") end end}, - { x=2, y=25, w=130, h=self.font_h*6, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=2, y=25, w=130, h=self.font_h*6, fct=function(button, x, y, xrel, yrel, tx, ty, event) self.changed = true self.sel = 1 + math.floor(ty / self.font_h) - if button == "left" then self:incStat(1) - elseif button == "right" then self:incStat(-1) + if button == "left" and event == "button" then self:incStat(1) + elseif button == "right" and event == "button" then self:incStat(-1) end end }, } diff --git a/game/modules/tome/dialogs/LevelupTalentsDialog.lua b/game/modules/tome/dialogs/LevelupTalentsDialog.lua index f85c518517..daf1af2551 100644 --- a/game/modules/tome/dialogs/LevelupTalentsDialog.lua +++ b/game/modules/tome/dialogs/LevelupTalentsDialog.lua @@ -69,11 +69,11 @@ function _M:init(actor, on_finish) }) self:mouseZones{ { x=0, y=0, w=game.w, h=game.h, mode={button=true}, norestrict=true, fct=function(button) if button ~= "none" then self.key:triggerVirtual("EXIT") end end}, - { x=2, y=65, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=2, y=65, w=350, h=self.font_h*self.max, fct=function(button, x, y, xrel, yrel, tx, ty, event) self.changed = true self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list) - if button == "left" then self:learn(true) - elseif button == "right" then self:learn(false) + if button == "left" and event == "button" then self:learn(true) + elseif button == "right" and event == "button" then self:learn(false) end self.changed = true end }, diff --git a/game/modules/tome/dialogs/MapMenu.lua b/game/modules/tome/dialogs/MapMenu.lua index c7e04a7545..50f65d7a47 100644 --- a/game/modules/tome/dialogs/MapMenu.lua +++ b/game/modules/tome/dialogs/MapMenu.lua @@ -49,10 +49,10 @@ function _M:init(mx, my, tmx, tmy) }) self:mouseZones{ { x=0, y=0, w=game.w, h=game.h, mode={button=true}, norestrict=true, fct=function(button) if button ~= "none" then game:unregisterDialog(self) end end}, - { x=0, y=0, w=350, h=self.ih, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=0, y=0, w=350, h=self.ih, fct=function(button, x, y, xrel, yrel, tx, ty, event) self.changed = true self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list) - if button == "left" then self:use() + if button == "left" and event == "button" then self:use() end end }, } diff --git a/game/modules/tome/dialogs/UseItemDialog.lua b/game/modules/tome/dialogs/UseItemDialog.lua index b6fe7aa2fd..7711df43ff 100644 --- a/game/modules/tome/dialogs/UseItemDialog.lua +++ b/game/modules/tome/dialogs/UseItemDialog.lua @@ -49,10 +49,10 @@ function _M:init(actor, object, item, inven, onuse) }) self:mouseZones{ { x=0, y=0, w=game.w, h=game.h, mode={button=true}, norestrict=true, fct=function(button) if button ~= "none" then game:unregisterDialog(self) end end}, - { x=0, y=0, w=350, h=self.ih, fct=function(button, x, y, xrel, yrel, tx, ty) + { x=0, y=0, w=350, h=self.ih, fct=function(button, x, y, xrel, yrel, tx, ty, event) self.changed = true self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list) - if button == "left" then self:use() + if button == "left" and event == "button" then self:use() end end }, } -- GitLab