Macro for picking random entry from array

This commit is contained in:
Pasi Kallinen
2023-12-05 10:06:27 +02:00
parent b98a70e3ec
commit 5dc94f3d83
24 changed files with 45 additions and 42 deletions

View File

@@ -956,7 +956,7 @@ fill_ordinary_room(struct mkroom *croom, boolean bonus_items)
WAN_DIGGING,
SPE_HEALING,
};
otyp = supply_items[rn2(SIZE(supply_items))];
otyp = ROLL_FROM(supply_items);
}
otmp = mksobj(otyp, TRUE, FALSE);
if (otyp == POT_HEALING && rn2(2))
@@ -991,7 +991,7 @@ fill_ordinary_room(struct mkroom *croom, boolean bonus_items)
SPBOOK_no_NOVEL,
SPBOOK_no_NOVEL
};
int oclass = extra_classes[rn2(SIZE(extra_classes))];
int oclass = ROLL_FROM(extra_classes);
otmp = mkobj(oclass, FALSE);
if (oclass == SPBOOK_no_NOVEL) {
/* bias towards lower level by generating again