diff options
author | Stefan O'Rear <stefanor@cox.net> | 2009-12-29 22:43:19 -0800 |
---|---|---|
committer | Stefan O'Rear <stefanor@cox.net> | 2009-12-29 22:44:54 -0800 |
commit | 8a504d20b9992fea2daac06faa6ca5559ca63ae0 (patch) | |
tree | 2e809b12b5e1020ebe4ee3237025081d5cd22816 /crawl-ref/source/item_use.cc | |
parent | 75c0968931bf47f6f718b91ce3f589cd9f815298 (diff) | |
download | crawl-ref-8a504d20b9992fea2daac06faa6ca5559ca63ae0.tar.gz crawl-ref-8a504d20b9992fea2daac06faa6ca5559ca63ae0.zip |
Give move/copy_item_to_grid responsibility for hazardous terrain
We now have much less duplication of logic, yay.
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r-- | crawl-ref/source/item_use.cc | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index fd01008e25..07aa928eb4 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -3113,7 +3113,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, pbolt.fire(); // The item can be destroyed before returning. - if (did_return && thrown_object_destroyed(&item, pbolt.target, true)) + if (did_return && thrown_object_destroyed(&item, pbolt.target)) did_return = false; } @@ -3178,8 +3178,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, return (hit); } -bool thrown_object_destroyed(item_def *item, const coord_def& where, - bool returning) +bool thrown_object_destroyed(item_def *item, const coord_def& where) { ASSERT(item != NULL); @@ -3244,22 +3243,6 @@ bool thrown_object_destroyed(item_def *item, const coord_def& where, // destruction: plus / (1 + plus) chance of survival. bool destroyed = (chance == 0) ? false : (one_chance_in(chance) && one_chance_in(item->plus + 1)); - bool hostile_grid = feat_destroys_items(grd(where)); - - // Non-returning items thrown into item-destroying grids are always - // destroyed. Returning items are only destroyed if they would have - // been randomly destroyed anyway. - if (returning && !destroyed) - hostile_grid = false; - - if (hostile_grid) - { - if (player_can_hear(where)) - mprf(MSGCH_SOUND, feat_item_destruction_message(grd(where))); - - item_was_destroyed(*item, NON_MONSTER); - destroyed = true; - } return destroyed; } |