Skip to content
Snippets Groups Projects
Commit 5cd42846 authored by dg's avatar dg
Browse files

fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@4177 51575b47-30f0-44d4-a5cc-537603b46e54
parent e4e57cf3
No related branches found
No related tags found
No related merge requests found
......@@ -39,7 +39,7 @@ function _M:receiveMouse(button, x, y, isup, force_name, extra)
if not isup then return end
if _M.drag then
if _M.drag.predrag then _M.drag = nil
if _M.drag.prestart then _M.drag = nil
else return self:endDrag(x, y) end
end
......@@ -102,15 +102,15 @@ end
function _M:startDrag(x, y, cursor, payload, on_done)
if _M.drag then
if math.max(math.abs(_M.drag.x - x), math.abs(_M.drag.y - y)) > 6 then
if _M.drag.prestart and math.max(math.abs(_M.drag.start_x - x), math.abs(_M.drag.start_y - y)) > 6 then
_M.drag.prestart = nil
if _M.drag.cursor then game:setMouseCursor(_M.drag.cursor, nil, 0, 0) end
print("[MOUSE] enabling drag from predrag")
end
return
end
_M.drag = {start_x=x, start_y=y, payload=payload, on_done=on_done, prestart=true}
if cursor then
game:setMouseCursor(cursor, nil, 0, 0)
end
_M.drag = {start_x=x, start_y=y, payload=payload, on_done=on_done, prestart=true, cursor=cursor}
print("[MOUSE] pre starting drag'n'drop")
end
......
......@@ -577,8 +577,6 @@ function getAdvancedMinionChances(self)
end
local function getMinionChances(self)
do return { ghoul=30, ghast=30, ghoulking=40 } end
local cl = math.floor(self:getTalentLevel(self.T_CREATE_MINIONS))
if cl <= 1 then
return { d_skel_warrior=55, skel_warrior=10, a_skel_warrior=0, skel_archer=10, skel_m_archer=0, skel_mage=5, ghoul=20, ghast=0, ghoulking=0 }
......
......@@ -41,7 +41,8 @@ end
function _M:onDrag(item)
if item and item.object then
local s = item.object:getEntityFinalSurface(nil, 64, 64)
game.mouse:startDrag(0, 0, s, {kind="inventory", id=item.object:getName{no_add_name=true, force_id=true, no_count=true}}, function(drag, used)
local x, y = core.mouse.get()
game.mouse:startDrag(x, y, s, {kind="inventory", id=item.object:getName{no_add_name=true, force_id=true, no_count=true}}, function(drag, used)
local x, y = core.mouse.get()
game.mouse:receiveMouse("drag-end", x, y, true, nil, {drag=drag})
end)
......
......@@ -132,7 +132,8 @@ function _M:onDrag(item)
if item and item.talent then
local t = self.actor:getTalentFromId(item.talent)
local s = t.display_entity:getEntityFinalSurface(nil, 64, 64)
game.mouse:startDrag(0, 0, s, {kind="talent", id=t.id}, function(drag, used)
local x, y = core.mouse.get()
game.mouse:startDrag(x, y, s, {kind="talent", id=t.id}, function(drag, used)
local x, y = core.mouse.get()
game.mouse:receiveMouse("drag-end", x, y, true, nil, {drag=drag})
if drag.used then self.c_list:drawTree() end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment