diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-01-11 18:24:10 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-01-11 18:24:10 +0000 |
commit | eea03c30a91f7a78848468aabcdf0ec9e1a79c81 (patch) | |
tree | f02d02b7ce2a56ce158d6fa9fbf4277b4d571676 /crawl-ref/source/item_use.cc | |
parent | 01a7854be4ec81cb35355e0273bf27633e73a0e5 (diff) | |
download | crawl-ref-eea03c30a91f7a78848468aabcdf0ec9e1a79c81.tar.gz crawl-ref-eea03c30a91f7a78848468aabcdf0ec9e1a79c81.zip |
Auto-id of fired missiles also auto-ids missiles fired from the same stack on the floor.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3249 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/item_use.cc')
-rw-r--r-- | crawl-ref/source/item_use.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 7a7fc98d8e..f5596ffec2 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1646,6 +1646,25 @@ static int dex_adjust_thrown_tohit(int hit) return stat_adjust(hit, you.dex, 13, 160, 90); } +static void identify_floor_missiles_matching(item_def mitem, int idflags) +{ + mitem.flags &= ~idflags; + int item = NON_ITEM; + for (int y = 0; y < GYM; ++y) + for (int x = 0; x < GXM; ++x) + { + item = igrd[x][y]; + while (item != NON_ITEM) + { + item_def &i(mitm[item]); + item = i.link; + + if ((i.flags & ISFLAG_THROWN) && items_stack(i, mitem)) + i.flags |= idflags; + } + } +} + // throw_it - currently handles player throwing only. Monster // throwing is handled in mstuff2:mons_throw() // Note: If teleport is true, assume that pbolt is already set up, @@ -2083,6 +2102,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, { set_ident_flags( item, ISFLAG_KNOW_PLUSES ); set_ident_flags( you.inv[throw_2], ISFLAG_KNOW_PLUSES ); + identify_floor_missiles_matching(item, ISFLAG_KNOW_PLUSES); mprf("You are firing %s.", you.inv[throw_2].name(DESC_NOCAP_A).c_str()); } @@ -2250,6 +2270,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, { set_ident_flags( item, ISFLAG_KNOW_PLUSES ); set_ident_flags( you.inv[throw_2], ISFLAG_KNOW_PLUSES ); + identify_floor_missiles_matching(item, ISFLAG_KNOW_PLUSES); mprf("You are throwing %s.", you.inv[throw_2].name(DESC_NOCAP_A).c_str()); } |