From ed68368fe1c0ab6d048934ec94509750ba2eafb6 Mon Sep 17 00:00:00 2001 From: Alex MacDonald Date: Tue, 17 Nov 2009 15:35:35 -0500 Subject: Created generic interface for detecting traps within a radius. Signed-off-by: David Ploog --- crawl-ref/source/spells2.cc | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'crawl-ref/source/spells2.cc') 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) -- cgit v1.2.3-54-g00ecf