diff options
author | Shmuale Mark <shm.mark@gmail.com> | 2014-08-03 13:59:36 -0400 |
---|---|---|
committer | Shmuale Mark <shm.mark@gmail.com> | 2014-08-03 14:17:14 -0400 |
commit | 2e52a0c19d866a6a15b36163fa145a94bbf9721f (patch) | |
tree | 1ad40aea10861227400db415ab1c2adaef44252b /crawl-ref/source/artefact.cc | |
parent | 2091673ee858097442a1668a947626a489639ece (diff) | |
download | crawl-ref-2e52a0c19d866a6a15b36163fa145a94bbf9721f.tar.gz crawl-ref-2e52a0c19d866a6a15b36163fa145a94bbf9721f.zip |
Hide a hack better.
Ideally, we wouldn't be using special for unrands totally different from
how items of the same type do, but that's less trivial than this commit.
A centralised place to check for being an unrand should at least make such
a change easier.
Diffstat (limited to 'crawl-ref/source/artefact.cc')
-rw-r--r-- | crawl-ref/source/artefact.cc | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/crawl-ref/source/artefact.cc b/crawl-ref/source/artefact.cc index 0aa8aa8ec8..4a2b26377b 100644 --- a/crawl-ref/source/artefact.cc +++ b/crawl-ref/source/artefact.cc @@ -343,10 +343,17 @@ bool is_random_artefact(const item_def &item) return item.flags & ISFLAG_RANDART; } -// returns true if item in an unrandart -bool is_unrandom_artefact(const item_def &item) +/** Is this an unrandart, and if so which one? + * + * @param item The item to be checked. + * @param which The unrand enum to be checked against (default 0). + * @returns true if item is an unrand, and if which is not 0, if it is the unrand + * specfied by enum in which. + */ +bool is_unrandom_artefact(const item_def &item, unrand_type which) { - return item.flags & ISFLAG_UNRANDART; + return item.flags & ISFLAG_UNRANDART + && (!which || which == item.special); } bool is_special_unrandom_artefact(const item_def &item) |