summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-17 05:08:34 +0000
committerpauldubois <pauldubois@c06c8d41-db1a-0410-9941-cceddc491573>2008-03-17 05:08:34 +0000
commit314a2c0efb7083bc9703b6e2f6ee4e054d000cc1 (patch)
tree901f0509c46d7445eedc1471804d8c70a25cf6da
parentc64c0e054c27bbdd37361f4a7125965d787f1598 (diff)
downloadcrawl-ref-314a2c0efb7083bc9703b6e2f6ee4e054d000cc1.tar.gz
crawl-ref-314a2c0efb7083bc9703b6e2f6ee4e054d000cc1.zip
- Move "shaft disappears in a puff of logic" logic further down, so it's
easier to test floating over traps - Don't yesno if an airborne player tries to move over a shaft. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3684 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/player.cc19
-rw-r--r--crawl-ref/source/traps.cc24
2 files changed, 24 insertions, 19 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 7dacf48f4c..28aa2d51a5 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -158,7 +158,8 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift,
#endif
|| new_grid == DNGN_TRAP_NATURAL)
{
- if (trap_type_at_xy(x,y) == TRAP_ZOT)
+ 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"))
@@ -168,6 +169,10 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift,
return (false);
}
}
+ else if (type == TRAP_SHAFT && you.airborne())
+ {
+ // No prompt
+ }
else
#ifdef CLUA_BINDINGS
// prompt for any trap where you might not have enough hp
@@ -177,13 +182,11 @@ bool move_player_to_grid( int x, int y, bool stepped, bool allow_shift,
"s", trap_name(x, y)))
#endif
{
- std::string prompt = "Really step ";
- prompt += (trap_type_at_xy(x,y) == TRAP_ALARM ?
- "onto" : "into");
- prompt += " that ";
- prompt += feature_description(new_grid, trap_type_at_xy(x,y),
- false, DESC_BASENAME, false);
- prompt += '?';
+ std::string prompt = make_stringf(
+ "Really step %s that %s?",
+ (type == TRAP_ALARM) ? "onto" : "into",
+ feature_description(new_grid, type,
+ false, DESC_BASENAME, false).c_str());
if (!yesno(prompt.c_str(), true, 'n'))
{
diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc
index ffa51a64e1..d84005a239 100644
--- a/crawl-ref/source/traps.cc
+++ b/crawl-ref/source/traps.cc
@@ -423,6 +423,17 @@ void handle_traps(trap_type trt, int i, bool trap_known)
// already know about it, don't let him/her notice it.
case TRAP_SHAFT:
{
+ if (!you.will_trigger_shaft())
+ {
+ if (trap_known && !you.airborne())
+ mpr("You don't fall through the shaft.");
+
+ if (!trap_known)
+ grd[you.x_pos][you.y_pos] = DNGN_UNDISCOVERED_TRAP;
+
+ return;
+ }
+
// Paranoia
if (!is_valid_shaft_level())
{
@@ -434,23 +445,14 @@ void handle_traps(trap_type trt, int i, bool trap_known)
return;
}
- if (!you.will_trigger_shaft())
- {
- if (trap_known && !you.airborne())
- mpr("You don't fall through the shaft..");
-
- if (!trap_known)
- grd[you.x_pos][you.y_pos] = DNGN_UNDISCOVERED_TRAP;
-
- return;
- }
-
if (!you.do_shaft())
+ {
if (!trap_known)
{
grd[you.x_pos][you.y_pos] = DNGN_UNDISCOVERED_TRAP;
return;
}
+ }
break;
}