From 1b118f124d13d86d7590ead3709fd56a16fa7804 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Tue, 2 Jan 2007 17:46:13 +0000 Subject: Moved i_feel_safe checks to the travel start functions themselves. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@770 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/acr.cc | 11 ++++------- crawl-ref/source/travel.cc | 15 ++++++++++++++- 2 files changed, 18 insertions(+), 8 deletions(-) (limited to 'crawl-ref') diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index ec6f786083..fa73929390 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -1243,11 +1243,9 @@ void process_command( command_type cmd ) { mpr("Sorry, you can't auto-travel out of here."); break; } - if (i_feel_safe(true)) - { - start_translevel_travel(); + start_translevel_travel(); + if (you.running) mesclr(); - } break; case CMD_EXPLORE: @@ -1257,8 +1255,7 @@ void process_command( command_type cmd ) { break; } // Start exploring - if (i_feel_safe(true)) - start_explore(Options.explore_greedy); + start_explore(Options.explore_greedy); break; case CMD_DISPLAY_MAP: @@ -1272,7 +1269,7 @@ void process_command( command_type cmd ) { plox[0] = 0; show_map(plox, true); redraw_screen(); - if (plox[0] > 0 && i_feel_safe(true)) + if (plox[0] > 0) start_travel(plox[0], plox[1]); break; diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 33df928db6..f637908f02 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -1829,6 +1829,9 @@ static level_pos prompt_translevel_target() void start_translevel_travel(const level_pos &pos) { + if (!i_feel_safe(true)) + return; + if (!can_travel_to(pos.id)) return; @@ -1858,6 +1861,9 @@ void start_translevel_travel(const level_pos &pos) void start_translevel_travel(bool prompt_for_destination) { + if (!i_feel_safe(true)) + return; + // Update information for this level. We need it even for the prompts, so // we can't wait to confirm that the user chose to initiate travel. travel_cache.get_level_info(level_id::current()).update(); @@ -2201,8 +2207,12 @@ static int find_transtravel_square(const level_pos &target, bool verbose) void start_travel(int x, int y) { // Redundant target? - if (x == you.x_pos && y == you.y_pos) return ; + if (x == you.x_pos && y == you.y_pos) + return ; + if (!i_feel_safe(true)) + return; + // Start running you.running = RMODE_TRAVEL; you.running.x = x; @@ -2241,6 +2251,9 @@ void start_travel(int x, int y) void start_explore(bool grab_items) { + if (!i_feel_safe(true)) + return; + you.running = grab_items? RMODE_EXPLORE_GREEDY : RMODE_EXPLORE; if (you.running == RMODE_EXPLORE_GREEDY && Options.stash_tracking != STM_ALL) -- cgit v1.2.3-54-g00ecf