diff options
author | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-31 01:03:57 +0000 |
---|---|---|
committer | zelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-05-31 01:03:57 +0000 |
commit | 336384033b1bfd1a7dab2df82b185481314051b7 (patch) | |
tree | 4bee92a140bf8997e909321a4c9e3ef71936b37c /crawl-ref/source/travel.cc | |
parent | 5ed9c78ba083cbfab2ed0eeb720cd3de176940b0 (diff) | |
download | crawl-ref-336384033b1bfd1a7dab2df82b185481314051b7.tar.gz crawl-ref-336384033b1bfd1a7dab2df82b185481314051b7.zip |
Fixed greedy mode explore_stop so that "items" stops when non-autopickup
items come into view and "greedy_items" stops when autopickup items come
into view.
Also added the new explore_stop conditions "glowing_items", "artefacts"
and "runes", which stops greedy explore when non-autopickup items which
are glowing/rune/etc, artefacts and runes (respectively) come into view.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5352 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/travel.cc')
-rw-r--r-- | crawl-ref/source/travel.cc | 44 |
1 files changed, 34 insertions, 10 deletions
diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 8eb88c5bff..866624b087 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -674,6 +674,10 @@ bool prompt_stop_explore(int es_why) } #define ES_item (Options.explore_stop & ES_ITEM) +#define ES_greedy (Options.explore_stop & ES_GREEDY_ITEM) +#define ES_glow (Options.explore_stop & ES_GLOWING_ITEM) +#define ES_art (Options.explore_stop & ES_ARTEFACT) +#define ES_rune (Options.explore_stop & ES_RUNE) #define ES_shop (Options.explore_stop & ES_SHOP) #define ES_stair (Options.explore_stop & ES_STAIR) #define ES_altar (Options.explore_stop & ES_ALTAR) @@ -687,7 +691,7 @@ inline static void _check_interesting_square(int x, int y, { const coord_def pos(x, y); - if (ES_item) + if (ES_item || ES_greedy || ES_glow || ES_art || ES_rune) { if (mgrd(pos) != NON_MONSTER) { @@ -1093,8 +1097,12 @@ command_type travel() if (lev && lev->needs_visit(new_x, new_y) && !lev->shop_needs_visit(new_x, new_y)) { - if ((Options.explore_stop & ES_ITEM) - && prompt_stop_explore(ES_ITEM)) + const int estop = + (you.running == RMODE_EXPLORE_GREEDY) ? + ES_GREEDY_PICKUP : ES_PICKUP; + + if ((Options.explore_stop & estop) + && prompt_stop_explore(estop)) { explore_stopped_pos = coord_def(new_x, new_y); stop_running(); @@ -3948,16 +3956,32 @@ void explore_discoveries::found_item(const coord_def &pos, const item_def &i) if (!current_level) current_level = StashTrack.find_current_level(); - if (current_level - && !(Options.explore_stop & ES_GREEDY_ITEM) - && _is_greed_inducing_square(current_level, pos)) - { - return; + if (current_level) + { + const bool greed_inducing = + _is_greed_inducing_square(current_level, pos); + + if (greed_inducing && (Options.explore_stop & ES_GREEDY_ITEM)) + ; // Stop for this conditions + else if (!greed_inducing + && ((Options.explore_stop & ES_ITEM) + || ((Options.explore_stop & ES_GLOWING_ITEM) + && (i.flags & ISFLAG_COSMETIC_MASK)) + || ((Options.explore_stop & ES_ARTEFACT) + && (i.flags & ISFLAG_ARTEFACT_MASK)) + || ((Options.explore_stop & ES_RUNE) + && is_rune(i)) )) + { + ; // More conditions to stop for + } + else + return; // No conditions met, don't stop for this item } - } + } // if (you.running == RMODE_EXPLORE_GREEDY) add_item(i); - es_flags |= ES_ITEM; + es_flags |= (you.running == RMODE_EXPLORE_GREEDY) ? ES_GREEDY_PICKUP : + ES_PICKUP; } // Expensive O(n^2) duplicate search, but we can live with that. |