summaryrefslogtreecommitdiffstats
path: root/crawl-ref
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2011-03-12 19:18:12 +0100
committerAdam Borowski <kilobyte@angband.pl>2011-03-12 19:18:12 +0100
commit3fc1cc2adb725a83a838ef82f67a3997a62ebaf9 (patch)
treeb6bd462ec9a11f6ac5611a0139a1f1b80c2be1bb /crawl-ref
parent4544842b0823e338cba268666fd2f8a362240d88 (diff)
downloadcrawl-ref-3fc1cc2adb725a83a838ef82f67a3997a62ebaf9.tar.gz
crawl-ref-3fc1cc2adb725a83a838ef82f67a3997a62ebaf9.zip
Fix placing Fire Storm on a wall.
Both in the old and new targetter you could aim it on a wall (tree, statue) and have no effect other than losing mana and causing noise. TODO: The message is wrong, fixing that would require a bit of refactoring I have partially stashed on another machine.
Diffstat (limited to 'crawl-ref')
-rw-r--r--crawl-ref/source/target.cc8
-rw-r--r--crawl-ref/source/target.h3
2 files changed, 8 insertions, 3 deletions
diff --git a/crawl-ref/source/target.cc b/crawl-ref/source/target.cc
index 0f0f1b7535..c95333ddf6 100644
--- a/crawl-ref/source/target.cc
+++ b/crawl-ref/source/target.cc
@@ -3,7 +3,9 @@
#include "target.h"
#include "beam.h"
+#include "env.h"
#include "player.h"
+#include "terrain.h"
bool targetter::set_aim(coord_def a)
{
@@ -35,8 +37,8 @@ aff_type targetter_view::is_affected(coord_def loc)
targetter_smite::targetter_smite(const actor* act, int ran,
- int exp_min, int exp_max):
- exp_range_min(exp_min), exp_range_max(exp_max)
+ int exp_min, int exp_max, bool wall_ok):
+ exp_range_min(exp_min), exp_range_max(exp_max), affects_walls(wall_ok)
{
ASSERT(act);
ASSERT(exp_min >= 0);
@@ -49,6 +51,8 @@ targetter_smite::targetter_smite(const actor* act, int ran,
bool targetter_smite::valid_aim(coord_def a)
{
+ if (!affects_walls && feat_is_solid(grd(a)))
+ return false;
if (a == origin)
return true;
if ((origin - a).abs() > range2)
diff --git a/crawl-ref/source/target.h b/crawl-ref/source/target.h
index 998c4abcca..1c5a2786c5 100644
--- a/crawl-ref/source/target.h
+++ b/crawl-ref/source/target.h
@@ -50,7 +50,7 @@ class targetter_smite : public targetter
{
public:
targetter_smite(const actor *act, int range = LOS_RADIUS,
- int exp_min = 0, int exp_max = 0);
+ int exp_min = 0, int exp_max = 0, bool wall_ok = false);
bool set_aim(coord_def a);
bool valid_aim(coord_def a);
aff_type is_affected(coord_def loc);
@@ -59,6 +59,7 @@ private:
// assumes exp_map is valid only if >0, so let's keep it private
int exp_range_min, exp_range_max;
explosion_map exp_map_min, exp_map_max;
+ bool affects_walls;
};
class targetter_reach : public targetter