From cfe2ed148efb0396116f923423e691f6a72c7421 Mon Sep 17 00:00:00 2001 From: dshaligram Date: Sun, 16 Dec 2007 12:13:09 +0000 Subject: Fixed acquirement not generating footwear. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3079 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/effects.cc | 14 ++++++++++++-- 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( + 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(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; -- cgit v1.2.3-54-g00ecf