summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-24 14:05:13 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2007-10-24 14:05:13 +0000
commitac738ba838f899d98ff0570e1070cdd62d6b77c5 (patch)
tree9e7e7c9602afc754150e76f8b80e1c96eda60be8 /crawl-ref/source
parent35129e9e324fd6464cb8799edfca960881a0dd09 (diff)
downloadcrawl-ref-ac738ba838f899d98ff0570e1070cdd62d6b77c5.tar.gz
crawl-ref-ac738ba838f899d98ff0570e1070cdd62d6b77c5.zip
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
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/command.cc3
-rw-r--r--crawl-ref/source/player.cc19
-rw-r--r--crawl-ref/source/player.h2
-rw-r--r--crawl-ref/source/view.cc3
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 =
"<w>Ctrl-X</w> : set travel eXclusion\n"
"<w>Ctrl-E</w> : Erase all travel exclusions\n"
"<w>Ctrl-W</w> : set Waypoint\n"
- "<w>Ctrl-C</w> : Clear level and main maps\n";
+ "<w>Ctrl-C</w> : Clear level and main maps\n"
+ "<w>Ctrl-F</w> : Forget level map\n";
static const char *targeting_help_1 =
"<h>Examine surroundings ('<w>x</w><h>' 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);