From 5a45e3bd8e7330880429c24955d9c4af1ec3608e Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Thu, 10 Jul 2008 16:18:59 +0000 Subject: Fix occasional jelly crash on unarmed characters. Fix quiver hanging on unthrowable missiles (e.g. javelins, nets for small species). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6478 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 4 ++-- crawl-ref/source/ouch.cc | 5 ++--- crawl-ref/source/quiver.cc | 6 ++++++ 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 225681b04b..593ebb50be 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -2408,10 +2408,10 @@ void process_command( command_type cmd ) int cur; you.m_quiver->get_desired_item(NULL, &cur); const int next = get_next_fire_item(cur, +1); -#ifdef DEBUG_QUIVER +//#ifdef DEBUG_QUIVER mprf(MSGCH_DIAGNOSTICS, "next slot: %d, item: %s", next, next == -1 ? "none" : you.inv[next].name(DESC_PLAIN).c_str()); -#endif +//#endif if (next != -1) { // Kind of a hacky way to get quiver to change. diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index 79ba0944ee..50248a8d25 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -309,8 +309,7 @@ void weapon_acid( char acid_strength ) msg::stream << "Your " << your_hand(true) << " burn!" << std::endl; ouch( roll_dice( 1, acid_strength ), 0, KILLED_BY_ACID ); } - - if (x_chance_in_y(acid_strength + 1, 20)) + else if (x_chance_in_y(acid_strength + 1, 20)) item_corrode( hand_thing ); } @@ -320,7 +319,7 @@ void item_corrode( int itco ) bool it_resists = false; // code simplifier {dlb} bool suppress_msg = false; // code simplifier {dlb} int how_rusty = ((you.inv[itco].base_type == OBJ_WEAPONS) - ? you.inv[itco].plus2 : you.inv[itco].plus); + ? you.inv[itco].plus2 : you.inv[itco].plus); // early return for "oRC and cloak/preservation {dlb}: if (wearing_amulet(AMU_RESIST_CORROSION) && !one_chance_in(10)) diff --git a/crawl-ref/source/quiver.cc b/crawl-ref/source/quiver.cc index da0ee0305b..e40a76159a 100644 --- a/crawl-ref/source/quiver.cc +++ b/crawl-ref/source/quiver.cc @@ -234,6 +234,7 @@ void player_quiver::on_item_fired(const item_def& item, bool explicitly_chosen) // Don't do anything if this item is not really fit for throwing. if (projected == LRET_FUMBLED) return; + #ifdef DEBUG_QUIVER mprf(MSGCH_DIAGNOSTICS, "item %s is for throwing", item.name(DESC_PLAIN).c_str()); @@ -405,6 +406,10 @@ void player_quiver::_get_fire_order( std::vector& order, if (you.equip[EQ_WEAPON] == i_inv) continue; + // Don't do anything if this item is not really fit for throwing. + if (is_launched(&you, you.weapon(), item) == LRET_FUMBLED) + continue; + // =f prevents item from being in fire order. if (!ignore_inscription_etc && strstr(item.inscription.c_str(), "=f")) @@ -415,6 +420,7 @@ void player_quiver::_get_fire_order( std::vector& order, for (unsigned int i_flags = 0; i_flags < Options.fire_order.size(); i_flags++) { + if (_item_matches(item, (fire_type) Options.fire_order[i_flags], launcher)) { -- cgit v1.2.3-54-g00ecf