From 67b7383f8ffce8e44347ba46bb6b7a396fc3134e Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 28 May 2009 10:06:05 +0000 Subject: Fix 2797560: Tiles crashing when clicking outside the map while targeting. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9841 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/directn.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'crawl-ref/source/directn.cc') diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index cc6b8ea9d7..5f6aa57fc9 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -149,6 +149,9 @@ void direction_choose_compass( dist& moves, targeting_behaviour *beh) if (gc == Region::NO_CURSOR) continue; + if (!map_bounds(gc)) + continue; + coord_def delta = gc - you.pos(); if (delta.x < -1 || delta.x > 1 || delta.y < -1 || delta.y > 1) @@ -160,7 +163,7 @@ void direction_choose_compass( dist& moves, targeting_behaviour *beh) } moves.delta = delta; - moves.isMe = delta.origin(); + moves.isMe = delta.origin(); break; } #endif @@ -1113,6 +1116,9 @@ void direction(dist& moves, targeting_type restricts, const coord_def &gc = tiles.get_cursor(); if (gc != Region::NO_CURSOR) { + if (!map_bounds(gc)) + continue; + moves.target = gc; if (key_command == CMD_TARGET_MOUSE_SELECT) -- cgit v1.2.3-54-g00ecf