diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-12-16 12:13:09 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-12-16 12:13:09 +0000 |
commit | cfe2ed148efb0396116f923423e691f6a72c7421 (patch) | |
tree | 75389b885ad951db1162f8ac5929c88eb7ae857c | |
parent | 8376e440396796e596cdd49b0d539b5fb48f16f0 (diff) | |
download | crawl-ref-cfe2ed148efb0396116f923423e691f6a72c7421.tar.gz crawl-ref-cfe2ed148efb0396116f923423e691f6a72c7421.zip |
Fixed acquirement not generating footwear.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3079 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/effects.cc | 14 | ||||
-rw-r--r-- | crawl-ref/source/stuff.cc | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index 5b9c309cf9..93b9eceaee 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -664,6 +664,15 @@ void random_uselessness(unsigned char ru, unsigned char sc_read_2) return; } // end random_uselessness() +static armour_type random_nonbody_armour_type() +{ + const armour_type at = + static_cast<armour_type>( + random_choose(ARM_SHIELD, ARM_CLOAK, ARM_HELMET, + ARM_GLOVES, ARM_BOOTS, -1)); + return (at); +} + static int find_acquirement_subtype(object_class_type class_wanted, int &quantity) { @@ -857,7 +866,8 @@ static int find_acquirement_subtype(object_class_type class_wanted, // one type of item for most of them. -- bwr // // OBJ_RANDOM is body armour and handled below - type_wanted = (coinflip()) ? OBJ_RANDOM : ARM_SHIELD + random2(5); + type_wanted = (coinflip())? OBJ_RANDOM : + static_cast<int>(random_nonbody_armour_type()); // some species specific fitting problems switch (you.species) @@ -933,7 +943,7 @@ static int find_acquirement_subtype(object_class_type class_wanted, || you.species == SP_SPRIGGAN || you.mutation[MUT_HORNS])) { - type_wanted = ARM_CAP; + type_wanted = coinflip()? ARM_CAP : ARM_WIZARD_HAT; } // Now we'll randomly pick a body armour (light only in the diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index 9e7f2a0b3e..6c35f2a993 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -271,6 +271,8 @@ int random_range(int low, int high, int nrolls) return (sum / nrolls); } +// Chooses one of the numbers passed in at random. The list of numbers +// must be terminated with -1. int random_choose(int first, ...) { va_list args; |