miscellaneous objects[] macros

Replace FIRST_GEM and LAST_GEM with FIRST_REAL_GEM, LAST_REAL_GEM,
FIRST_GLASS_GEM, and LAST_GLASS_GEM and define those along with
objects[] rather than separately.  Do the latter for FIRST_AMULET
and LAST_AMULET too.  Also new FIRST_SPELL and LAST_SPELL used to
compute MAXSPELLS.  (That value looks wrong to me, but this defines
it with the same value as before.  If it gets fixed, EDITLEVEL will
need to be incremented.)

This started as just proof of concept that extra information could
be collected as objects[] gets initialized at compile time.
This commit is contained in:
PatR
2022-12-28 01:50:24 -08:00
parent 57dc8891d6
commit ddd358aa03
10 changed files with 75 additions and 50 deletions

View File

@@ -171,9 +171,11 @@ enum objects_nums {
};
enum misc_object_nums {
LAST_GEM = (JADE),
NUM_GLASS_GEMS = ((LUCKSTONE - JADE) - 1),
MAXSPELL = ((SPE_BOOK_OF_THE_DEAD - SCR_BLANK_PAPER) + 1)
NUM_GLASS_GEMS = (LAST_GLASS_GEM - FIRST_GLASS_GEM + 1),
/* 1st +1: last-first subtraction; 2nd +1: extra empty spl_book[] slot;
currently LAST_SPELL includes blank, novel, and DeadBook so this
overallocates when used to define spl_book[] array */
MAXSPELL = (LAST_SPELL + 1 - FIRST_SPELL + 1),
};
extern NEARDATA struct objclass objects[NUM_OBJECTS + 1];