summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/stuff.h
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-18 08:15:47 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-02-18 08:15:47 +0000
commitf81ebd6b075237e35e1e736839610f585189feec (patch)
tree948315fbe438f7b6d8a918b1bf87b7ace56515d0 /crawl-ref/source/stuff.h
parent94d956b872a116e4523fc73fec1a0420c33615ee (diff)
downloadcrawl-ref-f81ebd6b075237e35e1e736839610f585189feec.tar.gz
crawl-ref-f81ebd6b075237e35e1e736839610f585189feec.zip
Book acquirement again:
* Weigh magic skills stronger to bias against manuals. * Fall through to randart (theme) books if all spells are known. * Allow spell school combinations (Conj/Fire) in naming randarts after hell lords and others. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9122 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/stuff.h')
-rw-r--r--crawl-ref/source/stuff.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/crawl-ref/source/stuff.h b/crawl-ref/source/stuff.h
index 2a63276b7a..464fb1794d 100644
--- a/crawl-ref/source/stuff.h
+++ b/crawl-ref/source/stuff.h
@@ -233,10 +233,10 @@ int choose_random_weighted(Iterator beg, const Iterator end)
int totalweight = 0;
int count = 0, result = 0;
- while ( beg != end )
+ while (beg != end)
{
totalweight += *beg;
- if ( random2(totalweight) < *beg )
+ if (random2(totalweight) < *beg)
{
result = count;
#if DEBUG
@@ -246,7 +246,9 @@ int choose_random_weighted(Iterator beg, const Iterator end)
++count;
++beg;
}
+#if DEBUG
ASSERT(times_set > 0);
+#endif
return result;
}