objects[] infrastructure

The bases[] array allows finding the index of the first object in
a particular class.  Extend it so that bases[class + 1] - 1 is a
reliable way to find the last object in any class.  The array had
to be extended by one so that the last class has a [class+1] entry
available, and object initialization now makes sure that classes
within objects[] are in ascending order so that [class+1] always
holds a higher index than [class].
This commit is contained in:
PatR
2020-04-19 04:18:22 -07:00
parent 8c744de8cd
commit 37ef5a2561
3 changed files with 42 additions and 15 deletions

View File

@@ -713,7 +713,7 @@ struct instance_globals {
const char *hname; /* name of the game (argv[0] of main) */
int hackpid; /* current process id */
char chosen_windowtype[WINTYPELEN];
int bases[MAXOCLASSES];
int bases[MAXOCLASSES + 1];
int multi;
const char *multi_reason;
int nroom;