git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7115 c06c8d41-db1a-0410-9941-cceddc491573
IGGGCRIN7IAVWJPQ5ORGGOFTUVE4ICTB6FQMNPIYZPFKB2VBZQZQC
SIDH2P7NBIG5KEOE27XHD3ZT2NQ2OJZFN6VZXWNWYFFY5YVXSSVQC
Q3B3UVMYEVC4YJUPYVSNTR4DJH4E6J4JJDHZNT5LNOCHCPPMEMXAC
static int _adjacent_cmd(const coord_def &gc, const MouseEvent &event){ coord_def dir = gc - you.pos(); for (int i = 0; i < 9; i++) { if (dir_dx[i] != dir.x || dir_dy[i] != dir.y) continue;
static int _adjacent_cmd(const coord_def &gc, const MouseEvent &event)
{
coord_def dir = gc - you.pos();
for (int i = 0; i < 9; i++)
if (dir_dx[i] != dir.x || dir_dy[i] != dir.y)
continue;
if (event.mod & MOD_SHIFT) return cmd_shift[i]; else if (event.mod & MOD_CTRL) return cmd_ctrl[i]; else return cmd_normal[i]; } return 0;}
if (event.mod & MOD_SHIFT)
return cmd_shift[i];
else if (event.mod & MOD_CTRL)
return cmd_ctrl[i];
else
return cmd_normal[i];
}
return 0;
// If adjacent, return that key (modified by shift or ctrl, etc...) coord_def dir = gc - you.pos(); for (unsigned int i = 0; i < 9; i++)
// If adjacent, return that key (modified by shift or ctrl, etc...)
for (unsigned int i = 0; i < 9; i++)
if (!in_bounds(gc)) return 0; int cmd = _adjacent_cmd(gc, event); if (cmd) return cmd; if (i_feel_safe())
if (!in_bounds(gc))
int cmd = _adjacent_cmd(gc, event);
if (cmd)
return cmd;
if (i_feel_safe())
if (dir_dx[i] == dir.x && dir_dy[i] == dir.y) { if (event.mod & MOD_SHIFT) return cmd_shift[i]; else if (event.mod & MOD_CTRL) return cmd_ctrl[i]; else return cmd_normal[i]; }
if (dir_dx[i] == dir.x && dir_dy[i] == dir.y)
start_travel(gc); return CK_MOUSE_CMD;
start_travel(gc);
return CK_MOUSE_CMD;
// Otherwise, travel to that grid. if (!in_bounds(gc))
// Otherwise, travel to that grid.
// 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)
// 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)
// Activate travel. start_travel(gc);
// Activate travel.
return _adjacent_cmd(dest, event);