From f080c133494f6430dd9078c438c90f9939e01b85 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Tue, 25 Mar 2008 19:36:08 +0000 Subject: Fixed tile compile. (I was being a bit overzealous in my cleanup.) Fix 1922815: blood potion assert. Implement 1828037: prompt before entering harmful clouds And tidy up fountain handling, dried non-magic fountains may now also start flowing again. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3878 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/player.cc | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'crawl-ref/source/player.cc') diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 3a4d4b7da4..80057f0d37 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -123,6 +123,28 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift, ASSERT( mgrd[x][y] == NON_MONSTER || mons_is_submerged( &menv[ mgrd[x][y] ] )); + const int cloud = env.cgrid[x][y]; + if (cloud != EMPTY_CLOUD) + { + const cloud_type ctype = env.cloud[ cloud ].type; + // don't prompt if already in a cloud of the same type + if (is_damaging_cloud(ctype, false) + && (env.cgrid[you.x_pos][you.y_pos] == EMPTY_CLOUD + || ctype != env.cloud[ env.cgrid[you.x_pos][you.y_pos] ].type)) + { + std::string prompt = make_stringf( + "Really step into that cloud of %s?", + cloud_name(ctype).c_str()); + + if (!yesno(prompt.c_str(), false, 'n')) + { + canned_msg(MSG_OK); + you.turn_is_over = false; + return (false); + } + } + } + // if we're walking along, give a chance to avoid trap if (stepped && !force && !you.confused()) { @@ -161,17 +183,16 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift, const trap_type type = trap_type_at_xy(x,y); if (type == TRAP_ZOT) { - if (! yes_or_no("Do you really want to step into the %s", - "Zot trap")) + if (!yes_or_no("Do you really want to step into the Zot trap")) { canned_msg(MSG_OK); you.turn_is_over = false; return (false); } } - else if (type == TRAP_SHAFT && you.airborne()) + else if (new_grid != DNGN_TRAP_MAGICAL && you.airborne()) { - // No prompt + // No prompt (shaft and mechanical traps ineffective, if flying) } else #ifdef CLUA_BINDINGS -- cgit v1.2.3-54-g00ecf