From d6b40e981b9ab1181deb2ea7baaf6f62b9fd2b35 Mon Sep 17 00:00:00 2001 From: Matthew Cline Date: Sun, 25 Oct 2009 02:48:22 -0700 Subject: FR 2792379: stop auto-explore on marked statues Markers can be placed on statues or orcish idols to cause auto-explore to stop when those statues/idols are first found. --- crawl-ref/docs/develop/level_design.txt | 7 +++++++ crawl-ref/source/terrain.cc | 5 +++++ crawl-ref/source/terrain.h | 1 + crawl-ref/source/travel.cc | 32 +++++++++++++++++++++++++++++++- crawl-ref/source/travel.h | 3 +++ 5 files changed, 47 insertions(+), 1 deletion(-) diff --git a/crawl-ref/docs/develop/level_design.txt b/crawl-ref/docs/develop/level_design.txt index 785433b1e6..802d9b6624 100644 --- a/crawl-ref/docs/develop/level_design.txt +++ b/crawl-ref/docs/develop/level_design.txt @@ -1869,6 +1869,13 @@ dungeon cell which they are on: * feature_description_long: What to use as the long description of the cell's feature. +* stop_explore: If set to anything, and placed on a cell with a statue + or orcish idol, will cause auto-explore to stop with the message + "Found ." + +* stop_explore_msg: Like stop_explore, but when auto-explore is stopped + the content of the property will be printed out as a message. + * veto_disintegrate: If this property is set to "veto" then the cell will be immune to disintegration. diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc index ae5ed894db..8f8344380d 100644 --- a/crawl-ref/source/terrain.cc +++ b/crawl-ref/source/terrain.cc @@ -328,6 +328,11 @@ bool feat_is_secret_door(dungeon_feature_type feat) return (feat == DNGN_SECRET_DOOR || feat == DNGN_DETECTED_SECRET_DOOR); } +bool feat_is_statue_or_idol(dungeon_feature_type feat) +{ + return (feat >= DNGN_ORCISH_IDOL && feat <= DNGN_STATUE_RESERVED); +} + bool feat_is_rock(dungeon_feature_type feat) { return (feat == DNGN_ORCISH_IDOL diff --git a/crawl-ref/source/terrain.h b/crawl-ref/source/terrain.h index 1cceb40020..2c442ced2f 100644 --- a/crawl-ref/source/terrain.h +++ b/crawl-ref/source/terrain.h @@ -26,6 +26,7 @@ bool feat_is_opaque(dungeon_feature_type feat); bool feat_is_solid(dungeon_feature_type feat); bool feat_is_closed_door(dungeon_feature_type feat); bool feat_is_secret_door(dungeon_feature_type feat); +bool feat_is_statue_or_idol(dungeon_feature_type feat); bool feat_is_rock(dungeon_feature_type feat); bool feat_is_permarock(dungeon_feature_type feat); bool feat_is_stone_stair(dungeon_feature_type feat); diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 6eeb0f632a..83ac8e9363 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -4191,6 +4191,27 @@ void explore_discoveries::found_feature(const coord_def &pos, altars.push_back(altar); es_flags |= ES_ALTAR; } + // Would checking for a makrer for all discovered cells slow things + // down too much? + else if (feat_is_statue_or_idol(feat)) + { + const std::string feat_stop_msg = + env.markers.property_at(pos, MAT_ANY, "stop_explore_msg"); + if (!feat_stop_msg.empty()) + { + marker_msgs.push_back(feat_stop_msg); + return; + } + + const std::string feat_stop = + env.markers.property_at(pos, MAT_ANY, "stop_explore"); + if (!feat_stop.empty()) + { + std::string desc = lowercase_first(feature_description(pos)); + marked_feats.push_back(desc); + return; + } + } } void explore_discoveries::add_stair( @@ -4333,8 +4354,16 @@ std::vector explore_discoveries::apply_quantities( bool explore_discoveries::prompt_stop() const { + const bool marker_stop = !marker_msgs.empty() || !marked_feats.empty(); + + for (unsigned int i = 0; i < marker_msgs.size(); i++) + mprf("%s", marker_msgs[i].c_str()); + + for (unsigned int i = 0; i < marked_feats.size(); i++) + mprf("Found %s", marked_feats[i].c_str()); + if (!es_flags) - return (false); + return (marker_stop); say_any(items, "Found %s items."); say_any(shops, "Found %s shops."); @@ -4343,5 +4372,6 @@ bool explore_discoveries::prompt_stop() const say_any(apply_quantities(stairs), "Found %s stairs."); return ((Options.explore_stop_prompt & es_flags) != es_flags + || marker_stop || prompt_stop_explore(es_flags)); } diff --git a/crawl-ref/source/travel.h b/crawl-ref/source/travel.h index 51b5cfdf4d..e23c5a3c05 100644 --- a/crawl-ref/source/travel.h +++ b/crawl-ref/source/travel.h @@ -298,6 +298,9 @@ private: std::vector< named_thing > shops; std::vector< named_thing > altars; + std::vector marker_msgs; + std::vector marked_feats; + private: template void say_any(const C &coll, const char *stub) const; template bool has_duplicates(citer, citer) const; -- cgit v1.2.3-54-g00ecf