From 069ab225fe3710059d8087049253e2f1c6ab80a5 Mon Sep 17 00:00:00 2001 From: ennewalker Date: Wed, 21 Jan 2009 04:30:40 +0000 Subject: [2496621] Disallowing detect spells in non-magic-mappable levels. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@8642 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/spl-cast.cc | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/spl-cast.cc') diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 45fe5cb012..4e26e41b5e 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -988,6 +988,15 @@ int _setup_evaporate_cast() return rc; } +static bool _can_cast_detect() +{ + if (!testbits(env.level_flags, LFLAG_NO_MAGIC_MAP)) + return true; + + mprf("You feel disoriented."); + return false; +} + // Returns SPRET_SUCCESS if spell is successfully cast for purposes of // exercising, SPRET_FAIL otherwise, or SPRET_ABORT if the player canceled // the casting. @@ -2019,21 +2028,27 @@ spret_type your_spells(spell_type spell, int powc, bool allow_fail) break; case SPELL_DETECT_SECRET_DOORS: - cast_detect_secret_doors(powc); + if (_can_cast_detect()) + cast_detect_secret_doors(powc); break; case SPELL_DETECT_TRAPS: - mprf("You detect %s", (detect_traps(powc) > 0) ? "traps!" - : "nothing."); + if (_can_cast_detect()) + mprf("You detect %s", (detect_traps(powc) > 0) ? "traps!" + : "nothing."); break; case SPELL_DETECT_ITEMS: - mprf("You detect %s", (detect_items(powc) > 0) ? "items!" - : "nothing."); + if (_can_cast_detect()) + mprf("You detect %s", (detect_items(powc) > 0) ? "items!" + : "nothing."); break; case SPELL_DETECT_CREATURES: { + if (!_can_cast_detect()) + break; + const int prev_detected = count_detected_mons(); const int num_creatures = detect_creatures(powc); -- cgit v1.2.3-54-g00ecf