summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/misc.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/misc.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/misc.cc')
-rw-r--r--crawl-ref/source/misc.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc
index 04c51de4a5..1e85627792 100644
--- a/crawl-ref/source/misc.cc
+++ b/crawl-ref/source/misc.cc
@@ -1269,14 +1269,12 @@ void search_around( bool only_adjacent )
else if (grd(*ri) == DNGN_UNDISCOVERED_TRAP
&& x_chance_in_y(effective + 1, 17))
{
- const int i = trap_at_xy(*ri);
-
- if (i != -1)
+ trap_def* ptrap = find_trap(*ri);
+ if (ptrap)
{
- grd(*ri) = trap_category(env.trap[i].type);
+ ptrap->reveal();
mpr("You found a trap!");
learned_something_new(TUT_SEEN_TRAP, *ri);
-
exercise(SK_TRAPS_DOORS, (coinflip() ? 2 : 1));
}
else
@@ -1720,7 +1718,7 @@ void down_stairs( int old_level, dungeon_feature_type force_stair,
branch_type old_where = you.where_are_you;
bool shaft = (!force_stair
- && trap_type_at_xy(you.pos()) == TRAP_SHAFT
+ && get_trap_type(you.pos()) == TRAP_SHAFT
|| force_stair == DNGN_TRAP_NATURAL);
level_id shaft_dest;
int shaft_level = -1;