diff options
author | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-16 19:24:52 +0000 |
---|---|---|
committer | j-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-02-16 19:24:52 +0000 |
commit | 5da6339cc93064c73c4541057df73c1347af78e9 (patch) | |
tree | b68c562c84f69638693f07ecab383b1019bdf3f2 /crawl-ref/source/shopping.cc | |
parent | 67251d8f0ceb7cdd3c73fed911a5d47c279e494c (diff) | |
download | crawl-ref-5da6339cc93064c73c4541057df73c1347af78e9.tar.gz crawl-ref-5da6339cc93064c73c4541057df73c1347af78e9.zip |
Minor fix.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9102 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/shopping.cc')
-rw-r--r-- | crawl-ref/source/shopping.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc index 61c5a41ca0..c39f30b748 100644 --- a/crawl-ref/source/shopping.cc +++ b/crawl-ref/source/shopping.cc @@ -1687,13 +1687,16 @@ unsigned int item_value( item_def item, bool ident ) } ASSERT(count_valid > 0); - std::sort(rarities, rarities + SPELLBOOK_SIZE); - for (int i = SPELLBOOK_SIZE - 1; i >= SPELLBOOK_SIZE - 3; i--) - rarity += rarities[i]; - if (count_valid > 3) count_valid = 3; + std::sort(rarities, rarities + SPELLBOOK_SIZE); + for (int i = SPELLBOOK_SIZE - 1; + i >= SPELLBOOK_SIZE - count_valid; i--) + { + rarity += rarities[i]; + } + rarity /= count_valid; } else |