From 6cd783423bef2d290172930c770c3f22e8e127ad Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Sun, 7 Jun 2009 21:24:43 +0000 Subject: * Fix double prompts for inscription warnings when clicking on the tiles inventory. * Change exclusions from buggy los back to full radius, so as not to delay the release any further. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/branches/stone_soup-0.5@9916 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/docs/changes.stone_soup | 1 - crawl-ref/source/it_use3.cc | 11 ++++----- crawl-ref/source/item_use.cc | 51 ++++++++++++++------------------------- crawl-ref/source/travel.cc | 8 +++++- crawl-ref/source/view.cc | 5 ++-- crawl-ref/source/view.h | 2 +- 6 files changed, 34 insertions(+), 44 deletions(-) diff --git a/crawl-ref/docs/changes.stone_soup b/crawl-ref/docs/changes.stone_soup index cf4fd73257..bff4661fe9 100644 --- a/crawl-ref/docs/changes.stone_soup +++ b/crawl-ref/docs/changes.stone_soup @@ -96,7 +96,6 @@ Interface * Some message condensation for identical messages. * Added stat_colour option to highlight dangerously low stats. * New option: Automatically set travel exclusions for statues and oklob plants. -* Limit travel exclusions to line of sight. * Switch off autopickup and autoswap if you see a monster turn invisible. * Killing an invisible monster reactivates autopickup. * Added ally pickup mode for items dropped by player and allies. diff --git a/crawl-ref/source/it_use3.cc b/crawl-ref/source/it_use3.cc index 693e23ea59..252385d124 100644 --- a/crawl-ref/source/it_use3.cc +++ b/crawl-ref/source/it_use3.cc @@ -808,7 +808,10 @@ bool evoke_item(int slot) if (prompt_failed(slot)) return (false); } - ASSERT (slot >= 0); + else if (!check_warning_inscriptions(you.inv[slot], OPER_EVOKE)) + return (false); + + ASSERT(slot >= 0); const bool wielded = (you.equip[EQ_WEAPON] == slot); @@ -817,13 +820,9 @@ bool evoke_item(int slot) if (!item_is_evokable(item, false, false, true)) return (false); - // Check inscriptions. - if (!check_warning_inscriptions(item, OPER_EVOKE)) - return (false); - int power = 0; int pract = 0; // By how much Evocations is practised. - bool did_work = false; // Used for default "nothing happens" message. + bool did_work = false; // Used for default "nothing happens" message. bool unevokable = false; switch (item.base_type) diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 776f68adb3..c6b391393a 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -181,9 +181,12 @@ static bool _valid_weapon_swap(const item_def &item) if (item.base_type == OBJ_WEAPONS || item.base_type == OBJ_STAVES) return (true); - // Misc. items need to be wielded to be evoked. - if (item.base_type == OBJ_MISCELLANY && item.sub_type != MISC_RUNE_OF_ZOT) + // Some misc. items need to be wielded to be evoked. + if (is_deck(item) || item.base_type == OBJ_MISCELLANY + && item.sub_type == MISC_LANTERN_OF_SHADOWS) + { return (true); + } // Some missiles need to be wielded for spells. if (item.base_type == OBJ_MISSILES) @@ -5424,23 +5427,11 @@ void tile_item_use_secondary(int idx) if (check_warning_inscriptions(item, OPER_FIRE)) fire_thing(idx); // fire weapons } - else if (item.base_type == OBJ_MISCELLANY - || item.base_type == OBJ_STAVES - && item_is_rod(item)) // unwield rods/misc. items - { - if (you.equip[EQ_WEAPON] == idx - && check_warning_inscriptions(item, OPER_WIELD)) - { - wield_weapon(true, PROMPT_GOT_SPECIAL); // unwield - } - } - else if (you.equip[EQ_WEAPON] == idx - && check_warning_inscriptions(item, OPER_WIELD)) + else if (you.equip[EQ_WEAPON] == idx) { wield_weapon(true, PROMPT_GOT_SPECIAL); // unwield } - else if (_valid_weapon_swap(item) - && check_warning_inscriptions(item, OPER_WIELD)) + else if (_valid_weapon_swap(item)) { // secondary wield for several spells and such wield_weapon(true, idx); // wield @@ -5473,37 +5464,36 @@ void tile_item_use(int idx) && (item.base_type == OBJ_ARMOUR || item.base_type == OBJ_JEWELLERY)) { - if (!check_warning_inscriptions(item, OPER_WIELD)) - return; - wield_weapon(true, PROMPT_GOT_SPECIAL); return; } + const int type = item.base_type; + // Use it - switch (item.base_type) + switch (type) { case OBJ_WEAPONS: case OBJ_STAVES: case OBJ_MISCELLANY: + case OBJ_WANDS: // Wield any unwielded item of these types. if (!equipped - && (item.base_type != OBJ_MISCELLANY || is_deck(item) - || item.sub_type == MISC_LANTERN_OF_SHADOWS)) + && (type == OBJ_WEAPONS || type == OBJ_STAVES || is_deck(item) + || type == OBJ_MISCELLANY + && item.sub_type == MISC_LANTERN_OF_SHADOWS)) { - if (check_warning_inscriptions(item, OPER_WIELD)) - wield_weapon(true, idx); + wield_weapon(true, idx); return; } - // Evoke misc. items and rods. + // Evoke misc. items, rods, or wands. if (item_is_evokable(item)) { - if (check_warning_inscriptions(item, OPER_EVOKE)) - evoke_item(idx); + evoke_item(idx); return; } // Unwield wielded items. - if (equipped && check_warning_inscriptions(item, OPER_WIELD)) + if (equipped) wield_weapon(true, PROMPT_GOT_SPECIAL); // unwield return; @@ -5527,11 +5517,6 @@ void tile_item_use(int idx) wear_armour(idx); return; - case OBJ_WANDS: - if (check_warning_inscriptions(item, OPER_ZAP)) - zap_wand(idx); - return; - case OBJ_CORPSES: if (you.species != SP_VAMPIRE || item.sub_type == CORPSE_SKELETON diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index d8e1344545..90a9b33817 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -313,7 +313,7 @@ void travel_exclude::set_exclude_show() { // ignores clouds feature_grid fgrid = _map_to_grid(pos); - losight(show, fgrid, pos, false, true); + losight(show, fgrid, pos, false, true, true); uptodate = true; } @@ -323,20 +323,26 @@ void init_exclusion_los() curr_excludes[i].set_exclude_show(); } +// Updating is useless if exclusions always use full radius. void update_exclusion_los(const coord_def &p) { +/* for (unsigned int i = 0; i < curr_excludes.size(); i++) if (!curr_excludes[i].uptodate && (curr_excludes[i].pos - p).abs() <= LOS_RADIUS * LOS_RADIUS) { curr_excludes[i].set_exclude_show(); } +*/ } +// Updating is useless if exclusions always use full radius. void mark_all_excludes_non_updated() { +/* for (unsigned int i = 0; i < curr_excludes.size(); i++) curr_excludes[i].uptodate = false; +*/ } static bool _is_excluded(const coord_def &p, diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 4cbd7f586e..9eeb3c1a86 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -2823,7 +2823,8 @@ int num_feats_between(const coord_def& source, const coord_def& target, // done by updating with a second array. void losight(env_show_grid &sh, feature_grid &gr, const coord_def& center, - bool clear_walls_block, bool ignore_clouds) + bool clear_walls_block, bool ignore_clouds, + bool full_radius) { raycast(); const int x_p = center.x; @@ -2835,7 +2836,7 @@ void losight(env_show_grid &sh, // clear out sh sh.init(0); - if (crawl_state.arena || crawl_state.arena_suspended) + if (full_radius || crawl_state.arena || crawl_state.arena_suspended) { for (int y = -ENV_SHOW_OFFSET; y <= ENV_SHOW_OFFSET; ++y) for (int x = -ENV_SHOW_OFFSET; x <= ENV_SHOW_OFFSET; ++x) diff --git a/crawl-ref/source/view.h b/crawl-ref/source/view.h index 3210182862..22d3d331b4 100644 --- a/crawl-ref/source/view.h +++ b/crawl-ref/source/view.h @@ -72,7 +72,7 @@ void find_features(const std::vector& features, void losight(env_show_grid &sh, feature_grid &gr, const coord_def& center, bool clear_walls_block = false, - bool ignore_clouds = false); + bool ignore_clouds = false, bool full_radius = false); bool magic_mapping(int map_radius, int proportion, bool suppress_msg, -- cgit v1.2.3-54-g00ecf