summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spells4.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/spells4.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/spells4.cc')
-rw-r--r--crawl-ref/source/spells4.cc11
1 files changed, 5 insertions, 6 deletions
diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc
index 5e3c4ad0f6..21052d9ba4 100644
--- a/crawl-ref/source/spells4.cc
+++ b/crawl-ref/source/spells4.cc
@@ -1701,7 +1701,6 @@ bool cast_fragmentation(int pow, const dist& spd)
{
bolt beam;
int debris = 0;
- int trap;
bool explode = false;
bool hole = true;
const char *what = NULL;
@@ -1951,9 +1950,9 @@ bool cast_fragmentation(int pow, const dist& spd)
case DNGN_UNDISCOVERED_TRAP:
case DNGN_TRAP_MECHANICAL:
- trap = trap_at_xy(spd.target);
- if (trap != -1
- && trap_category(env.trap[trap].type) != DNGN_TRAP_MECHANICAL)
+ {
+ trap_def* ptrap = find_trap(spd.target);
+ if (ptrap && ptrap->category() != DNGN_TRAP_MECHANICAL)
{
// Non-mechanical traps don't explode with this spell. -- bwr
break;
@@ -1969,9 +1968,9 @@ bool cast_fragmentation(int pow, const dist& spd)
beam.damage.num = 2;
// Exploded traps are nonfunctional, ammo is also ruined -- bwr
- grd(spd.target) = DNGN_FLOOR;
- env.trap[trap].type = TRAP_UNASSIGNED;
+ ptrap->destroy();
break;
+ }
//
// Stone doors and arches