summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tilereg.cc
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-11 22:49:25 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2009-01-11 22:49:25 +0000
commitf2dadb170e53ea704a03718b1d322a927cd9ff43 (patch)
tree940a613a7439dd7f5db313a1bb1a3ff12c7e5da6 /crawl-ref/source/tilereg.cc
parentc189cc37d4a2e1b018059965189cbcef3b00e444 (diff)
downloadcrawl-ref-f2dadb170e53ea704a03718b1d322a927cd9ff43.tar.gz
crawl-ref-f2dadb170e53ea704a03718b1d322a927cd9ff43.zip
[2499508] Left-clicking on the minimap now behaves identically to left-clicking on the dungeon (in both travel behavior and shift/ctrl-clicking.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8418 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tilereg.cc')
-rw-r--r--crawl-ref/source/tilereg.cc54
1 files changed, 28 insertions, 26 deletions
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index cc4f543043..4291b18a74 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -786,6 +786,32 @@ static int _adjacent_cmd(const coord_def &gc, const MouseEvent &event)
return 0;
}
+static int _click_travel(const coord_def &gc, MouseEvent &event)
+{
+ if (!in_bounds(gc))
+ return 0;
+
+ int cmd = _adjacent_cmd(gc, event);
+ if (cmd)
+ return cmd;
+
+ if (i_feel_safe())
+ {
+ start_travel(gc);
+ return CK_MOUSE_CMD;
+ }
+
+ // If not safe, then take one step towards the click.
+ travel_pathfind tp;
+ tp.set_src_dst(you.pos(), gc);
+ const coord_def dest = tp.pathfind(RMODE_TRAVEL);
+
+ if (!dest.x && !dest.y)
+ return 0;
+
+ return _adjacent_cmd(dest, event);
+}
+
int DungeonRegion::handle_mouse(MouseEvent &event)
{
tiles.clear_text_tags(TAG_CELL_DESC);
@@ -878,28 +904,7 @@ int DungeonRegion::handle_mouse(MouseEvent &event)
if (event.button != MouseEvent::LEFT)
return 0;
- if (!in_bounds(gc))
- return 0;
-
- int cmd = _adjacent_cmd(gc, event);
- if (cmd)
- return cmd;
-
- if (i_feel_safe())
- {
- start_travel(gc);
- return CK_MOUSE_CMD;
- }
-
- // If not safe, then take one step towards the click.
- travel_pathfind tp;
- tp.set_src_dst(you.pos(), gc);
- const coord_def dest = tp.pathfind(RMODE_TRAVEL);
-
- if (!dest.x && !dest.y)
- return 0;
-
- return _adjacent_cmd(dest, event);
+ return _click_travel(gc, event);
}
void DungeonRegion::to_screen_coords(const coord_def &gc, coord_def &pc) const
@@ -1899,10 +1904,7 @@ int MapRegion::handle_mouse(MouseEvent &event)
case MouseEvent::PRESS:
if (event.button == MouseEvent::LEFT)
{
- if (!in_bounds(gc))
- return 0;
-
- start_travel(gc);
+ return _click_travel(gc, event);
}
else if (event.button == MouseEvent::RIGHT)
{