summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/direct.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-11 11:23:33 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-04-11 11:23:33 +0000
commit7896dbd29bda379c2fb31feeb3b16bda57039c00 (patch)
treed7f820c06e503416aa61dee002c9358c24ade813 /crawl-ref/source/direct.cc
parent0fe8afdd2c0c0bcac82f6f1237181dc6fb1c58c2 (diff)
downloadcrawl-ref-7896dbd29bda379c2fb31feeb3b16bda57039c00.tar.gz
crawl-ref-7896dbd29bda379c2fb31feeb3b16bda57039c00.zip
Fix 1937869: Have weapon swapping respect spells the character knows
and allow wielding the appropriate items, e.g. arrows for Sticks to Snakes etc. Use the same rules for clicking on items in Tiles. Also add yet another minimap colour option, this time for plants (really zero xp monsters in general) since I became tired of plant-rich vaults showing up in bright red colours. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4195 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/direct.cc')
-rw-r--r--crawl-ref/source/direct.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/crawl-ref/source/direct.cc b/crawl-ref/source/direct.cc
index 3b89368585..ac34d64f0a 100644
--- a/crawl-ref/source/direct.cc
+++ b/crawl-ref/source/direct.cc
@@ -1098,9 +1098,9 @@ static void describe_oos_square(int x, int y)
bool in_vlos(int x, int y)
{
- return in_los_bounds(x, y)
- && (env.show(view2show(coord_def(x, y)))
- || coord_def(x, y) == grid2view(you.pos()));
+ return (in_los_bounds(x, y)
+ && (env.show(view2show(coord_def(x, y)))
+ || coord_def(x, y) == grid2view(you.pos())));
}
bool in_vlos(const coord_def &pos)
@@ -1115,28 +1115,30 @@ bool in_los(int x, int y)
static bool find_monster( int x, int y, int mode, int range = -1)
{
+ // target the player for friendly and general spells
if ((mode == TARG_FRIEND || mode == TARG_ANY)
&& x == you.x_pos && y == you.y_pos)
{
return (true);
}
-
+
// don't target out of range
if (!_is_target_in_range(x, y, range))
return (false);
-
+
const int targ_mon = mgrd[ x ][ y ];
-
+
// No monster or outside LOS.
if (targ_mon == NON_MONSTER || !in_los(x,y))
return (false);
-
+
// Unseen monsters in shallow water show a "strange disturbance"
// (unless flying!)
if (!player_monster_visible(&menv[targ_mon]))
{
// since you can't see the monster, assume it's not a friend
- return (mode != TARG_FRIEND && grd[x][y] == DNGN_SHALLOW_WATER
+ return (mode != TARG_FRIEND
+ && grd[x][y] == DNGN_SHALLOW_WATER
&& !mons_flies(&menv[targ_mon]));
}