From e46965c192b6ddc04357366a2f136d6e2115bb59 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Wed, 25 Apr 2007 19:41:46 +0000 Subject: 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 --- crawl-ref/source/items.cc | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'crawl-ref/source/items.cc') 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); +} -- cgit v1.2.3-54-g00ecf