extern void compact_objects(int size);
extern void wipe_o_list(void);
extern s16b o_pop(void);
-extern errr get_obj_num_prep(void);
extern s16b get_obj_num(int level);
extern void object_known(object_type *o_ptr);
extern void object_aware(object_type *o_ptr);
/*
* Apply a "object restriction function" to the "object allocation table"
*/
-errr get_obj_num_prep(void)
+static errr get_obj_num_prep(void)
{
int i;
{
int k_idx;
- /*
- * Hack -- If restriction is already specified, allocation table is
- * should be prepared by get_obj_num_prep().
- * We rely previous preparation before reaching here.
- */
/* Good objects */
if ((mode & AM_GOOD) && !get_obj_num_hook)
{
- /* Activate restriction (if already specified, use it) */
+ /* Activate restriction (if already specified, use that) */
get_obj_num_hook = kind_is_good;
-
- /* Prepare allocation table */
- get_obj_num_prep();
}
+ /* Restricted objects - prepare allocation table */
+ if (get_obj_num_hook) get_obj_num_prep();
+
/* Pick a random object */
k_idx = get_obj_num(base);
- /* Good objects */
+ /* Restricted objects */
if (get_obj_num_hook)
{
/* Clear restriction */
get_obj_num_hook = NULL;
- /* Prepare allocation table */
+ /* Reset allocation table to default */
get_obj_num_prep();
}
else
get_obj_num_hook = kind_is_book;
- /* Prepare allocation table */
- get_obj_num_prep();
-
/* Make a book */
make_object(q_ptr, mo_mode);
/* Activate restriction */
get_obj_num_hook = kind_is_cloak;
- /* Prepare allocation table */
- get_obj_num_prep();
-
/* Make a cloak */
make_object(q_ptr, mo_mode);
/* Activate restriction */
get_obj_num_hook = kind_is_polearm;
- /* Prepare allocation table */
- get_obj_num_prep();
-
/* Make a poleweapon */
make_object(q_ptr, mo_mode);
/* Activate restriction */
get_obj_num_hook = kind_is_armor;
- /* Prepare allocation table */
- get_obj_num_prep();
-
/* Make a hard armor */
make_object(q_ptr, mo_mode);
/* Activate restriction */
get_obj_num_hook = kind_is_sword;
- /* Prepare allocation table */
- get_obj_num_prep();
-
/* Make a sword */
make_object(q_ptr, mo_mode);