diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-04-25 19:41:46 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-04-25 19:41:46 +0000 |
commit | e46965c192b6ddc04357366a2f136d6e2115bb59 (patch) | |
tree | d35217c1c5b22d20e6070865ff92fefe7d5a1cd1 /crawl-ref/source/items.cc | |
parent | 3729bb7d83361ee5032dcc513e5740da08798be6 (diff) | |
download | crawl-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/items.cc')
-rw-r--r-- | crawl-ref/source/items.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 22ef3e05d7..af953b7d15 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -58,6 +58,7 @@ #include "shopping.h" #include "skills.h" #include "spl-cast.h" +#include "spl-book.h" #include "stuff.h" #include "stash.h" #include "tutorial.h" @@ -3144,3 +3145,21 @@ void cmd_destroy_item( void ) } } #endif + +//////////////////////////////////////////////////////////////////////// +// item_def functions. + +bool item_def::has_spells() const +{ + return ((base_type == OBJ_BOOKS && item_type_known(*this) + && sub_type != BOOK_DESTRUCTION + && sub_type != BOOK_MANUAL) + || count_staff_spells(*this, true) > 1); +} + +int item_def::book_number() const +{ + return (base_type == OBJ_BOOKS? sub_type : + base_type == OBJ_STAVES? sub_type + 40 : + -1); +} |