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

@@ -1404,6 +1404,9 @@ typedef uint32_t mmflags_nht; /* makemon MM_ flags */
/* monster shooting a wand; note: not -9 to -0 because -0 is ambiguous */
#define BZ_M_WAND(bztyp) (-30 - (bztyp)) /* -39..-30 */
/* pick a random entry from array */
#define ROLL_FROM(array) array[rn2(SIZE(array))]
#define FEATURE_NOTICE_VER(major, minor, patch) \
(((unsigned long) major << 24) | ((unsigned long) minor << 16) \
| ((unsigned long) patch << 8) | ((unsigned long) 0))