diff options
author | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-02 19:51:50 +0000 |
---|---|---|
committer | haranp <haranp@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-07-02 19:51:50 +0000 |
commit | 4293d91bfd7e4b10b7cdee76dc7d5da7e5e3e001 (patch) | |
tree | 071c35be0b6d5541418b190765e47591ca0229b5 /crawl-ref/source/ouch.cc | |
parent | 8030e3981a5ff0333ae659cbd08763c09ffdede0 (diff) | |
download | crawl-ref-4293d91bfd7e4b10b7cdee76dc7d5da7e5e3e001.tar.gz crawl-ref-4293d91bfd7e4b10b7cdee76dc7d5da7e5e3e001.zip |
Many code cleanups, mostly involving using stack_iterator and
radius_iterator instead of the previous setup.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6347 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/ouch.cc')
-rw-r--r-- | crawl-ref/source/ouch.cc | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index 7f61b825bf..4ff2e61713 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -551,21 +551,17 @@ void expose_items_to_element(beam_type flavour, int x, int y) if (target_class == OBJ_UNASSIGNED) return; - for (int i = igrd[x][y]; i != NON_ITEM; i = mitm[i].link) + for (stack_iterator si(coord_def(x,y)); si; ++si) { - if (!is_valid_item(mitm[i])) + if (!is_valid_item(*si)) continue; - if (is_valid_item(mitm[i]) - && (mitm[i].base_type == target_class - || (target_class == OBJ_FOOD - && mitm[i].base_type == OBJ_CORPSES))) + if ( si->base_type == target_class + || (target_class == OBJ_FOOD && si->base_type == OBJ_CORPSES)) { - num_dest += mitm[i].quantity; - - item_was_destroyed(mitm[i]); - - destroy_item(i); + num_dest += si->quantity; + item_was_destroyed(*si); + destroy_item(si->index()); } } @@ -674,7 +670,7 @@ void lose_level() void drain_exp(bool announce_full) { - int protection = player_prot_life(); + const int protection = player_prot_life(); if (protection == 3) { @@ -698,9 +694,7 @@ void drain_exp(bool announce_full) unsigned long total_exp = exp_needed( you.experience_level + 2 ) - exp_needed( you.experience_level + 1 ); - unsigned long exp_drained = total_exp * (10 + random2(11)); - - exp_drained /= 100; + unsigned long exp_drained = (total_exp * (10 + random2(11))) / 100; // TSO's protection. if (you.religion == GOD_SHINING_ONE && you.piety > protection * 50) |