summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/spl-book.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-25 19:41:46 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-04-25 19:41:46 +0000
commite46965c192b6ddc04357366a2f136d6e2115bb59 (patch)
treed35217c1c5b22d20e6070865ff92fefe7d5a1cd1 /crawl-ref/source/spl-book.cc
parent3729bb7d83361ee5032dcc513e5740da08798be6 (diff)
downloadcrawl-ref-e46965c192b6ddc04357366a2f136d6e2115bb59.tar.gz
crawl-ref-e46965c192b6ddc04357366a2f136d6e2115bb59.zip
Allow describing rod/spellbook spells from the examine command (jarpiain).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1370 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spl-book.cc')
-rw-r--r--crawl-ref/source/spl-book.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc
index 07ac68b5ac..33c201f6f2 100644
--- a/crawl-ref/source/spl-book.cc
+++ b/crawl-ref/source/spl-book.cc
@@ -693,10 +693,7 @@ unsigned char spellbook_contents( item_def &book, int action,
bool update_screen = !fs;
const int spell_levels = player_spell_levels();
-
- // special case for staves
- const int type = (book.base_type == OBJ_STAVES) ? book.sub_type + 40
- : book.sub_type;
+ const int type = book.book_number();
bool spell_skills = false;
@@ -1311,8 +1308,8 @@ int count_staff_spells(const item_def &item, bool need_id)
return (0);
const int stype = item.sub_type;
- const int type = stype + 40;
- if (stype < STAFF_SMITING || stype >= STAFF_AIR)
+ const int type = item.book_number();
+ if (stype < STAFF_SMITING || stype >= STAFF_AIR || type == -1)
return (0);
int nspel = 0;
@@ -1347,7 +1344,7 @@ int staff_spell( int staff )
int mana, diff, food, energy;
item_def& istaff(you.inv[staff]);
// converting sub_type into book index type
- const int type = istaff.sub_type + 40;
+ const int type = istaff.book_number();
// Spell staves are mostly for the benefit of non-spellcasters, so we're
// not going to involve INT or Spellcasting skills for power. -- bwr