generic object fix
When hallucinating, random object selection for objects was including the new generic objects. It was already excluding 'strange object' by using 'rn2(NUM_OBJECTS - 1) + 1' to skip objects[0]; changing that to be 'rn2(NUM_OBJECTS - MAXOCLASSES) + MAXOCLASSES' will skip the first 18 objects, 'strange object' plus the 17 generic objects. (I'm trying to convince myself that there's no off-by-1 or off-by-N error and think I've succeeded.)
This commit is contained in:
@@ -180,9 +180,11 @@
|
||||
* random_object()
|
||||
*
|
||||
* Respectively return a random monster or object.
|
||||
* random_object() won't return STRANGE_OBJECT or the generic objects.
|
||||
* -/+ MAXOCLASSES is used to skip it and them.
|
||||
*/
|
||||
#define random_monster(rng) rng(NUMMONS)
|
||||
#define random_object(rng) (rng(NUM_OBJECTS - 1) + 1)
|
||||
#define random_monster(rng) ((*rng)(NUMMONS))
|
||||
#define random_object(rng) ((*rng)(NUM_OBJECTS - MAXOCLASSES) + MAXOCLASSES)
|
||||
|
||||
/*
|
||||
* what_obj()
|
||||
|
||||
Reference in New Issue
Block a user