From 5da6339cc93064c73c4541057df73c1347af78e9 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Mon, 16 Feb 2009 19:24:52 +0000 Subject: Minor fix. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9102 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/shopping.cc | 11 +++++++---- 1 file 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 -- cgit v1.2.3-54-g00ecf