diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-03-29 13:39:28 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-03-29 13:39:28 +0000 |
commit | de34ddf0332412f89db35487c8fd6b33cffea28b (patch) | |
tree | 9d2eafe4d48ccdcfc212b313efc33784f8f65591 | |
parent | 2bdb5cf7bc9a6136ded38eca54ae019dcf0c6beb (diff) | |
download | crawl-ref-de34ddf0332412f89db35487c8fd6b33cffea28b.tar.gz crawl-ref-de34ddf0332412f89db35487c8fd6b33cffea28b.zip |
Fixed directionally challenged ball lightning (Ryan Kusnery).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1121 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/ghost.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/monstuff.cc | 9 | ||||
-rw-r--r-- | crawl-ref/source/stuff.h | 5 |
3 files changed, 8 insertions, 8 deletions
diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc index 52077c4e77..5e4044dde7 100644 --- a/crawl-ref/source/ghost.cc +++ b/crawl-ref/source/ghost.cc @@ -577,7 +577,7 @@ int ghost_demon::n_extra_ghosts() if (you.where_are_you == BRANCH_ECUMENICAL_TEMPLE) return (0); - // No multiple ghosts until level 14 of the Main Dungeon. + // No multiple ghosts until level 9 of the Main Dungeon. if ((lev < 9 && you.where_are_you == BRANCH_MAIN_DUNGEON) || (subdepth < 2 && you.where_are_you == BRANCH_LAIR) || (subdepth < 2 && you.where_are_you == BRANCH_ORCISH_MINES)) diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc index 4534a5020d..4dffb17f14 100644 --- a/crawl-ref/source/monstuff.cc +++ b/crawl-ref/source/monstuff.cc @@ -2125,13 +2125,8 @@ static bool handle_special_ability(struct monsters *monster, bolt & beem) continue; // faking LOS by checking the neighbouring square - int dx = targ->x - monster->x; - if (dx) - dx /= dx; - - int dy = targ->y - monster->y; - if (dy) - dy /= dy; + int dx = sgn(targ->x - monster->x); + int dy = sgn(targ->y - monster->y); const int tx = monster->x + dx; const int ty = monster->y + dy; diff --git a/crawl-ref/source/stuff.h b/crawl-ref/source/stuff.h index 9c958361a1..82b8727b7a 100644 --- a/crawl-ref/source/stuff.h +++ b/crawl-ref/source/stuff.h @@ -112,6 +112,11 @@ inline int cap_int(int val, int cap) return (val > cap? cap : val); } +template <typename Z> inline Z sgn(Z x) +{ + return (x < 0? -1 : (x > 0? 1 : 0)); +} + bool is_trap_square(int x, int y); void zap_los_monsters(); |