eliminate the uses of the manually maintained BL_MASK_BITS

Use CONDITION_SIZE which does not require manual updating.

Also attempts to adjust win32 graphics window port for
the new fields.

That port has its own field names and should be adjusted
to using the following which are declared extern in
include/botl.h.

   struct conditions[CONDITION_COUNT];
   int cond_idx[CONDITION_COUNT];

The former contains the fields that were port-specifically
added to the win32 graphical port and more, plus it is
centrally maintained and currently utilized by tty and curses.

The cond_idx[] array contains the ranked ordering of the
condition fields from highest ranking to lowest. Instead
of indexing like this:
	int i;
	for (i = 0; i < CONDITION_COUNT; ++i) {
	    ...conditons[i].enabled;
 	    ...condtions[i].text[0];
	}

you can use the ranked ordering like this:
	int i, ci;
	for (i = 0; i < CONDITION_COUNT; ++i) {
	    ci = cond_idx[i];
	    ...conditons[ci].enabled;
 	    ...condtions[ci].text[0];
	}
This commit is contained in:
nhmall
2020-02-08 20:40:38 -05:00
parent 4096ce8454
commit 2da95e4dc0
4 changed files with 52 additions and 31 deletions

View File

@@ -114,7 +114,7 @@ enum blconditions {
#define BL_MASK_TRAPPED 0x04000000L
#define BL_MASK_UNCONSC 0x08000000L
#define BL_MASK_WOUNDEDL 0x10000000L
#define BL_MASK_BITS 28 /* number of mask bits that can be set */
#define BL_MASK_BITS 29 /* number of mask bits that can be set */
/* clang-format on */
struct conditions_t {