diff options
author | Alex MacDonald <alex@alexjmacdonald.com> | 2009-11-17 15:35:35 -0500 |
---|---|---|
committer | David Ploog <dploog@users.sourceforge.net> | 2009-11-18 00:21:21 +0100 |
commit | ed68368fe1c0ab6d048934ec94509750ba2eafb6 (patch) | |
tree | 83ce72925db9145e44276bfc2f6ea8751068ddda /crawl-ref/source/spells2.cc | |
parent | 3a6efa8421c1461ae7b8191d3ac57a819abe5eb4 (diff) | |
download | crawl-ref-ed68368fe1c0ab6d048934ec94509750ba2eafb6.tar.gz crawl-ref-ed68368fe1c0ab6d048934ec94509750ba2eafb6.zip |
Created generic interface for detecting traps within a radius.
Signed-off-by: David Ploog <dploog@users.sourceforge.net>
Diffstat (limited to 'crawl-ref/source/spells2.cc')
-rw-r--r-- | crawl-ref/source/spells2.cc | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 58f66d2bae..ab3c2d378f 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -55,27 +55,10 @@ int detect_traps(int pow) { pow = std::min(50, pow); - int traps_found = 0; + // Trap detection moved to traps.cc. -am const int range = 8 + random2(8) + pow; - - for (int i = 0; i < MAX_TRAPS; i++) - { - trap_def& trap = env.trap[i]; - - if (!trap.active()) - continue; - - if (grid_distance(you.pos(), trap.pos) < range && !trap.is_known()) - { - traps_found++; - trap.reveal(); - set_map_knowledge_obj(trap.pos, show_type(grd(trap.pos))); - set_terrain_mapped(trap.pos); - } - } - - return (traps_found); + return reveal_traps(range); } int detect_items(int pow) |