From e7a22ae2c3721277180443d930d110edb7e180b8 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Tue, 15 Jul 2008 22:46:43 +0000 Subject: Apply commit r6569 to 0.4 trunk. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.4@6570 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/docs/changes.stone_soup | 7 +++++-- crawl-ref/source/acr.cc | 20 ++++++++------------ crawl-ref/source/beam.cc | 26 +++++++++++++------------- crawl-ref/source/command.cc | 17 ++++------------- crawl-ref/source/invent.cc | 2 ++ crawl-ref/source/item_use.cc | 21 +++++++++------------ crawl-ref/source/mon-data.h | 2 +- crawl-ref/source/quiver.cc | 7 +------ crawl-ref/source/spells4.cc | 19 ++++++++++--------- crawl-ref/source/spl-cast.cc | 6 ++++-- crawl-ref/source/version.h | 2 +- 11 files changed, 58 insertions(+), 71 deletions(-) diff --git a/crawl-ref/docs/changes.stone_soup b/crawl-ref/docs/changes.stone_soup index 52657fc770..8bedc795e2 100644 --- a/crawl-ref/docs/changes.stone_soup +++ b/crawl-ref/docs/changes.stone_soup @@ -3,12 +3,15 @@ Stone Soup 0.4.1 (200807??) Disclaimer: These are merely the highlights, not an exhaustive list of changes. -* Fixed crashes related to mapmark.lua. +(* Fixed crashes related to mapmark.lua.) * Fixed crash when attempting to autoinscribe non-artefacts via '{'. -* Fixed Crawl looping infinitely upon "good random choice" for Thief/Wanderer +* Fixed Crawl looping infinitely upon "good random choice" for Thief/Wanderer. +* Fixed crashes when selecting an item with no appropriate items in inventory. +* Fixed targetting prompts being ignored or having the wrong result. * Fixed vampire bat jewellery exploit. * Fixed kills by hell effects counting as player kills. * Fixed friendly pickup toggle being inappropriately disallowed. +* Fixed known bad potions being subject to autopickup. Stone Soup 0.4.0 (20080714) diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index fbc4d3fd50..3dcb424d40 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -560,11 +560,11 @@ static void _handle_wizard_command( void ) { // This command isn't very exciting... feel free to replace. int i = prompt_invent_item( "Value of which item?", MT_INVLIST, -1 ); - if (i == PROMPT_ABORT || !is_random_artefact( you.inv[i] )) - { - canned_msg( MSG_OK ); + + if (prompt_failed(i)) break; - } + else if (!is_random_artefact( you.inv[i] )) + mpr("That item is not an artefact!"); else mprf("randart val: %d", randart_value(you.inv[i])); @@ -574,11 +574,9 @@ static void _handle_wizard_command( void ) { int i = prompt_invent_item( "Make an artefact out of which item?", MT_INVLIST, -1 ); - if (i == PROMPT_ABORT) - { - canned_msg( MSG_OK ); + + if (prompt_failed(i)) break; - } if (!_item_type_can_be_artefact(you.inv[i].base_type)) { @@ -680,11 +678,9 @@ static void _handle_wizard_command( void ) { // This command isn't very exciting but it's useful for debugging. int i = prompt_invent_item( "(Un)curse which item?", MT_INVLIST, -1 ); - if (i == PROMPT_ABORT) - { - canned_msg( MSG_OK ); + + if (prompt_failed(i)) break; - } item_def& item(you.inv[i]); diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index fcef99e3ba..71cbfb8c87 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -688,21 +688,21 @@ bool player_tracer( zap_type ztype, int power, bolt &pbolt, int range) if (range > 0) pbolt.rangeMax = range; - pbolt.is_tracer = true; - pbolt.source_x = you.x_pos; - pbolt.source_y = you.y_pos; - pbolt.can_see_invis = player_see_invis(); - pbolt.smart_monster = true; - pbolt.attitude = ATT_FRIENDLY; + pbolt.is_tracer = true; + pbolt.source_x = you.x_pos; + pbolt.source_y = you.y_pos; + pbolt.can_see_invis = player_see_invis(); + pbolt.smart_monster = true; + pbolt.attitude = ATT_FRIENDLY; // Init tracer variables. - pbolt.foe_count = pbolt.fr_count = 0; - pbolt.foe_power = pbolt.fr_power = 0; - pbolt.fr_helped = pbolt.fr_hurt = 0; - pbolt.foe_helped = pbolt.foe_hurt = 0; - pbolt.foe_ratio = 100; - pbolt.beam_cancelled= false; - pbolt.dont_stop_foe = pbolt.dont_stop_fr = false; + pbolt.foe_count = pbolt.fr_count = 0; + pbolt.foe_power = pbolt.fr_power = 0; + pbolt.fr_helped = pbolt.fr_hurt = 0; + pbolt.foe_helped = pbolt.foe_hurt = 0; + pbolt.foe_ratio = 100; + pbolt.beam_cancelled = false; + pbolt.dont_stop_foe = pbolt.dont_stop_fr = pbolt.dont_stop_player = false; fire_beam(pbolt); diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index 6ebf009edf..86879504ea 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -140,7 +140,6 @@ static std::string _get_version_changes(void) std::string help; char buf[200]; bool start = false; - bool skip_lines = true; while (fgets(buf, sizeof buf, fp)) { // Remove trailing spaces. @@ -152,18 +151,10 @@ static std::string _get_version_changes(void) break; } help = buf; - // Give up if you encountered the second set of underliners - // and still haven't encountered the keyword "Highlights". - if (help.find("---") != std::string::npos) - { - if (skip_lines) - { - skip_lines = false; - continue; - } - else if (!start) - break; - } + + // Give up if you encounter an older version. + if (help.find("Stone Soup 0.3.4") != std::string::npos) + break; if (help.find("Highlights") != std::string::npos) { diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index bc39a7d3b3..34c1fdbaea 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -353,6 +353,8 @@ static std::string _no_selectables_message(int item_selector) return("You aren't carrying any decks from which to draw."); case OBJ_FOOD: return("You aren't carrying any food."); + case OBJ_POTIONS: + return("You aren't carrying any potions."); case OBJ_SCROLLS: case OBJ_BOOKS: return("You aren't carrying any books or scrolls."); diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index e449ce82cd..3a202aa312 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -798,7 +798,7 @@ bool armour_prompt( const std::string & mesg, int *index, operation_types oper) } return (succeeded); -} // end armour_prompt() +} static bool cloak_is_being_removed( void ) { @@ -3163,8 +3163,8 @@ bool puton_ring(int slot, bool prompt_finger) else { item_slot = prompt_invent_item( "Put on which piece of jewellery?", - MT_INVLIST, OBJ_JEWELLERY, true, true, true, 0, -1, - NULL, OPER_PUTON ); + MT_INVLIST, OBJ_JEWELLERY, true, true, + true, 0, -1, NULL, OPER_PUTON ); } if (prompt_failed(item_slot)) @@ -3309,10 +3309,10 @@ bool remove_ring(int slot, bool announce) if (hand_used == EQ_NONE) { const int equipn = - (slot == -1)? prompt_invent_item( "Remove which piece of jewellery?", - MT_INVLIST, - OBJ_JEWELLERY, true, true, true, - 0, -1, NULL, OPER_REMOVE) + (slot == -1)? prompt_invent_item("Remove which piece of jewellery?", + MT_INVLIST, + OBJ_JEWELLERY, true, true, true, + 0, -1, NULL, OPER_REMOVE) : slot; if (prompt_failed(equipn)) @@ -3598,6 +3598,7 @@ void prompt_inscribe_item() } item_slot = prompt_invent_item("Inscribe which item? ", MT_INVLIST, OSEL_ANY ); + if (prompt_failed(item_slot)) return; @@ -4110,12 +4111,8 @@ static bool _handle_enchant_armour( int item_slot ) OSEL_ENCH_ARM, true, true, false ); } - if (item_slot == PROMPT_ABORT || item_slot == PROMPT_NOTHING) - { - if (item_slot == PROMPT_ABORT) - canned_msg( MSG_OK ); + if (prompt_failed(item_slot)) return (false); - } item_def& arm(you.inv[item_slot]); diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h index bfd9e3746b..56cc5c8da0 100644 --- a/crawl-ref/source/mon-data.h +++ b/crawl-ref/source/mon-data.h @@ -1872,7 +1872,7 @@ { {AT_BITE, AF_DRAIN_XP, 20}, {AT_CLAW, AF_PLAIN, 15}, {AT_CLAW, AF_PLAIN, 15}, AT_NO_ATK }, { 17, 5, 5, 0 }, - 15, 10, MST_SHADOW_DRAGON, CE_MUTAGEN_RANDOM, Z_BIG, S_ROAR, I_ANIMAL, + 15, 10, MST_SHADOW_DRAGON, CE_HCL, Z_BIG, S_ROAR, I_ANIMAL, HT_LAND, 10, DEFAULT_ENERGY, MONUSE_NOTHING, SIZE_HUGE }, diff --git a/crawl-ref/source/quiver.cc b/crawl-ref/source/quiver.cc index e40a76159a..12b8d5a9ad 100644 --- a/crawl-ref/source/quiver.cc +++ b/crawl-ref/source/quiver.cc @@ -147,12 +147,7 @@ void choose_item_for_quiver() OSEL_THROWABLE, true, true, true, '-', you.equip[EQ_WEAPON], NULL, OPER_QUIVER ); - if (slot == PROMPT_ABORT) - { - canned_msg(MSG_OK); - return; - } - else if (slot == PROMPT_NOTHING) + if (prompt_failed(slot)) return; if (slot == PROMPT_GOT_SPECIAL) // '-' or empty quiver diff --git a/crawl-ref/source/spells4.cc b/crawl-ref/source/spells4.cc index 3acf2fe0b4..1809fbc1a8 100644 --- a/crawl-ref/source/spells4.cc +++ b/crawl-ref/source/spells4.cc @@ -1419,18 +1419,19 @@ bool cast_evaporate(int pow, bolt& beem, int potion) } // Fire tracer. - beem.source_x = you.x_pos; - beem.source_y = you.y_pos; - beem.can_see_invis = player_see_invis(); - beem.smart_monster = true; - beem.attitude = ATT_FRIENDLY; - beem.fr_count = 0; - beem.is_tracer = true; + beem.source_x = you.x_pos; + beem.source_y = you.y_pos; + beem.can_see_invis = player_see_invis(); + beem.smart_monster = true; + beem.attitude = ATT_FRIENDLY; + beem.fr_count = 0; + beem.beam_cancelled = false; + beem.is_tracer = true; fire_beam(beem); - if (beem.fr_count > 0) + if (beem.beam_cancelled) { - // We don't want to fire through friendlies. + // We don't want to fire through friendlies or at ourselves. canned_msg(MSG_OK); return (false); } diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 6364789e5f..35b27a7a07 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -1019,9 +1019,11 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) { potion = prompt_invent_item("Throw which potion?", MT_INVLIST, OBJ_POTIONS); - if (potion == -1) + + if (prompt_failed(potion)) return (SPRET_ABORT); - else if (you.inv[potion].base_type != OBJ_POTIONS) + + if (you.inv[potion].base_type != OBJ_POTIONS) { mpr("This spell works only on potions!"); return (SPRET_ABORT); diff --git a/crawl-ref/source/version.h b/crawl-ref/source/version.h index 0ddccc970e..014d802d3c 100644 --- a/crawl-ref/source/version.h +++ b/crawl-ref/source/version.h @@ -37,7 +37,7 @@ #define CRAWL "Dungeon Crawl Stone Soup" -#define VER_NUM "0.4" +#define VER_NUM "0.4.1" #define VER_QUAL "" // last updated 07august2001 {mv} -- cgit v1.2.3-54-g00ecf