Skip to content
Snippets Groups Projects
Commit 1b0c9129 authored by dg's avatar dg
Browse files

Talent errors are more explicit

Fixed the "getTarget" bug after a talent bugs

git-svn-id: http://svn.net-core.org/repos/t-engine4@4948 51575b47-30f0-44d4-a5cc-537603b46e54
parent c2b24494
No related branches found
No related tags found
No related merge requests found
......@@ -127,10 +127,12 @@ function _M:useTalent(id, who, force_level, ignore_cd, force_target)
local old_target
if force_level then old_level = who.talents[id]; who.talents[id] = force_level end
if force_target then old_target = rawget(who, "getTarget"); who.getTarget = function(a) return force_target.x, force_target.y, not force_target.__no_self and force_target end end
local ret = ab.action(who, ab)
local ok, ret = xpcall(function() return ab.action(who, ab) end, debug.traceback)
if force_target then who.getTarget = old_target end
if force_level then who.talents[id] = old_level end
if not ok then error(ret) end
if not self:postUseTalent(ab, ret) then return end
-- Everything went ok? then start cooldown if any
......
......@@ -396,7 +396,7 @@ function _M:setupMouse(mouse)
if button == "left" and not xrel and not yrel and event == "button" then
local tmx, tmy = math.floor(bx / 4), math.floor(by / 4)
game.player:mouseMove(tmx + game.minimap_scroll_x, tmy + game.minimap_scroll_y)
elseif button == "right" then
elseif button == "right" and self.level then
local tmx, tmy = math.floor(bx / 4), math.floor(by / 4)
self.level.map:moveViewSurround(tmx + game.minimap_scroll_x, tmy + game.minimap_scroll_y, 1000, 1000)
end
......
......@@ -737,10 +737,6 @@ int resizeWindow(int width, int height)
void do_resize(int w, int h, bool fullscreen)
{
SDL_DisplayMode mode;
SDL_GetDesktopDisplayMode(0, &mode);
w = mode.w; h = mode.h;
if (!window)
{
window = SDL_CreateWindow("TE4", 0, 0, w, h, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | (fullscreen ? SDL_WINDOW_FULLSCREEN : 0));
......
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