summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/describe.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-02-18 15:51:08 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2008-02-18 15:51:08 +0000
commita59025b069d3d08cfa7c5ccd21d3b0ae116da71c (patch)
treec15ea1bf8d4491edc73efef473413ddfc30a09ff /crawl-ref/source/describe.cc
parente3c41fc21fc88f1e1edb67992a7cb0bbe68abe83 (diff)
downloadcrawl-ref-a59025b069d3d08cfa7c5ccd21d3b0ae116da71c.tar.gz
crawl-ref-a59025b069d3d08cfa7c5ccd21d3b0ae116da71c.zip
First batch of Paul's patches:
1896018: cycle ammo with '(' 1895278: no (v)iewing of unreadable books 1895075: cancel Ely's abilities without cost Fix 1894920: fix overly long dungeon overview Also fix 1884145: weapon swap ignoring {!w} git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3441 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/describe.cc')
-rw-r--r--crawl-ref/source/describe.cc17
1 files changed, 14 insertions, 3 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc
index 829a04fe43..00edf93c78 100644
--- a/crawl-ref/source/describe.cc
+++ b/crawl-ref/source/describe.cc
@@ -1621,6 +1621,10 @@ std::string get_item_description( const item_def &item, bool verbose,
break;
case OBJ_BOOKS:
+ if (! player_can_read_spellbook( item ))
+ description << "This book is beyond your current level of understanding.$$";
+ break;
+
case OBJ_SCROLLS:
case OBJ_POTIONS:
case OBJ_ORBS:
@@ -1686,7 +1690,8 @@ void describe_feature_wide(int x, int y)
getch();
}
-static void show_item_description(const item_def &item)
+// Return true if spells can be shown to player
+static bool show_item_description(const item_def &item)
{
clrscr();
@@ -1697,6 +1702,8 @@ static void show_item_description(const item_def &item)
if (item.has_spells())
{
+ if (item.base_type == OBJ_BOOKS && !player_can_read_spellbook( item ))
+ return false;
formatted_string fs;
item_def dup = item;
spellbook_contents( dup,
@@ -1705,7 +1712,10 @@ static void show_item_description(const item_def &item)
: RBOOK_USE_STAFF,
&fs );
fs.display(2, -2);
+ return true;
}
+
+ return false;
}
static bool describe_spells(const item_def &item)
@@ -1739,8 +1749,9 @@ void describe_item( item_def &item, bool allow_inscribe )
{
for (;;)
{
- show_item_description(item);
- if (item.has_spells())
+ const bool spells_shown = show_item_description(item);
+
+ if (spells_shown)
{
cgotoxy(1, wherey());
textcolor(LIGHTGREY);