From ac738ba838f899d98ff0570e1070cdd62d6b77c5 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Wed, 24 Oct 2007 14:05:13 +0000 Subject: Add a "forget level map" command, Ctrl-F, to level map. This command used to be for waypoints along with Ctrl-W but as that never made it into the level map help I don't think it matters. (FR 1745112) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@2537 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/command.cc | 3 ++- crawl-ref/source/player.cc | 19 ++++++++++++------- crawl-ref/source/player.h | 2 +- crawl-ref/source/view.cc | 3 +++ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index 2075188735..039aff4b07 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -557,7 +557,8 @@ static const char *level_map_help = "Ctrl-X : set travel eXclusion\n" "Ctrl-E : Erase all travel exclusions\n" "Ctrl-W : set Waypoint\n" - "Ctrl-C : Clear level and main maps\n"; + "Ctrl-C : Clear level and main maps\n" + "Ctrl-F : Forget level map\n"; static const char *targeting_help_1 = "Examine surroundings ('x' in main):\n" diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index af1a809c48..e36a13035e 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -2574,19 +2574,24 @@ bool you_resist_magic(int power) return 1; */ } -void forget_map(unsigned char chance_forgotten) +// force is true for forget_map command on level map +void forget_map(unsigned char chance_forgotten, bool force) { - unsigned char xcount, ycount = 0; + if ( force && !yesno("Really forget level map?", true, 'n') ) + return; - for (xcount = 0; xcount < GXM; xcount++) + for (unsigned char xcount = 0; xcount < GXM; xcount++) { - for (ycount = 0; ycount < GYM; ycount++) + for (unsigned char ycount = 0; ycount < GYM; ycount++) { - if (random2(100) < chance_forgotten) - env.map[xcount][ycount].clear(); + if (!see_grid(xcount, ycount) && + (force || random2(100) < chance_forgotten)) + { + env.map[xcount][ycount].clear(); + } } } -} // end forget_map() +} // end forget_map() void gain_exp( unsigned int exp_gained, unsigned int* actual_gain, unsigned int* actual_avail_gain) diff --git a/crawl-ref/source/player.h b/crawl-ref/source/player.h index 443c6666d6..dd12489769 100644 --- a/crawl-ref/source/player.h +++ b/crawl-ref/source/player.h @@ -282,7 +282,7 @@ void display_char_status(void); /* *********************************************************************** * called from: item_use - items - misc - spells - spells3 * *********************************************************************** */ -void forget_map(unsigned char chance_forgotten); +void forget_map(unsigned char chance_forgotten = 100, bool force = false); // last updated 19may2000 {dlb} diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index cfbb4788df..ff8ad57325 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -2941,6 +2941,9 @@ void show_map( coord_def &spec_place, bool travel_mode ) break; case CONTROL('F'): + forget_map(100, true); + break; + case CONTROL('W'): travel_cache.add_waypoint(start_x + curs_x - 1, start_y + curs_y - 1); -- cgit v1.2.3-54-g00ecf