summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells3.cc
diff options
context:
space:
mode:
authorharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-01 17:44:09 +0000
committerharanp <haranp@c06c8d41-db1a-0410-9941-cceddc491573>2008-10-01 17:44:09 +0000
commitbb183e9257bd99caeab9776b3579acf68cb203b1 (patch)
treeca8904e3d8db4aa6db1991b0ffebdb5d932ea6fe /crawl-ref/source/spells3.cc
parente32c3272ea58ddf7bf596bbf0ec5c62ec6c42018 (diff)
downloadcrawl-ref-bb183e9257bd99caeab9776b3579acf68cb203b1.tar.gz
crawl-ref-bb183e9257bd99caeab9776b3579acf68cb203b1.zip
Reworked traps: much much cleaner now. There might be bugs, though.
Traps now remember how much ammo they have. The ammo quantities (from David) are rather tentative. Breaks savefiles. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@7076 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells3.cc')
-rw-r--r--crawl-ref/source/spells3.cc27
1 files changed, 9 insertions, 18 deletions
diff --git a/crawl-ref/source/spells3.cc b/crawl-ref/source/spells3.cc
index dc2f817dd2..85add52f2d 100644
--- a/crawl-ref/source/spells3.cc
+++ b/crawl-ref/source/spells3.cc
@@ -1432,17 +1432,9 @@ bool entomb(int powc)
if (env.cgrid(*ai) != EMPTY_CLOUD)
delete_cloud( env.cgrid(*ai) );
- // mechanical traps are destroyed {dlb}:
- int which_trap = trap_at_xy(*ai);
- if ( which_trap != -1 )
- {
- trap_struct& trap(env.trap[which_trap]);
- if (trap_category(trap.type) == DNGN_TRAP_MECHANICAL)
- {
- trap.type = TRAP_UNASSIGNED;
- trap.pos.set(1,1);
- }
- }
+ // All traps are destroyed
+ if (trap_def* ptrap = find_trap(*ai))
+ ptrap->destroy();
// Finally, place the wall {dlb}:
grd(*ai) = DNGN_ROCK_WALL;
@@ -1627,14 +1619,13 @@ bool cast_sanctuary(const int power)
if (env.map(pos).property == FPROP_BLOODY && see_grid(pos))
blood_count++;
- if (trap_type_at_xy(pos) != NUM_TRAPS
- && grd(pos) == DNGN_UNDISCOVERED_TRAP)
+ if (trap_def* ptrap = find_trap(pos))
{
- const dungeon_feature_type type =
- trap_category( trap_type_at_xy(pos) );
- grd(pos) = type;
- set_envmap_obj(pos, type);
- trap_count++;
+ if (!ptrap->is_known())
+ {
+ ptrap->reveal();
+ ++trap_count;
+ }
}
// forming patterns