Check_bitvector_names will never work as intended. Check_object passes in 32 bits at a time. Check_bitvector_names puts these 32 bits into a 64 bit variable and looks for invalid bits between 35 and and 64. These bits wouldn’t even exist in the first element of the array. They would be in the second element, but this would get processed the same way. The second element gets passed in and the code evaluates bits 35 thru 64. In order for this to produce valid results we would have to look at the entire array as single chunk of 128 bits and look for any bit greater than 35. The easiest solution might be to pass in the array element so that the function can calculate which bit is actually being evaluated or just pass in the entire array.
From check_object
for(y = 0; y < TW_ARRAY_MAX; y++) {
error |= check_bitvector_names(GET_OBJ_WEAR(obj)[y], wear_bits_count, objname, "object wear");
error |= check_bitvector_names(GET_OBJ_EXTRA(obj)[y], extra_bits_count, objname, "object extra");
error |= check_bitvector_names(GET_OBJ_AFFECT(obj)[y], affected_bits_count, objname, "object affect");
}
GET_OBJ_AFFECT(obj)[y] – int
bits – unsigned long int
namecount – unsigned long int
flagnum – unsigned int
static int check_bitvector_names(bitvector_t bits, size_t namecount, const char *whatami, const char *whatbits)
{
unsigned int flagnum;
for (flagnum = namecount; flagnum < sizeof(bitvector_t) * 8; flagnum++) {
if ((1 << flagnum) & bits) {
Attached is a proposed solution. It will produce the following errors for and object like this.
#1250
unfinished object~
an unfinished object~
An unfinished object is lying here.~
~
0 0 0 0 0 a 0 0 0 dF aF bF aF
0 0 0 0
0 0 0 0 0
Jun 11 13:33:46 2020 :: SYSERR: Object #1250 (an unfinished object) has unknown object affect flag, bit 31 in element 1 (0 through 34 known).
Jun 11 13:33:46 2020 :: SYSERR: Object #1250 (an unfinished object) has unknown object affect flag, bit 1 in element 2 (0 through 34 known).
Jun 11 13:33:46 2020 :: SYSERR: Object #1250 (an unfinished object) has unknown object affect flag, bit 31 in element 2 (0 through 34 known).
Jun 11 13:33:46 2020 :: SYSERR: Object #1250 (an unfinished object) has unknown object affect flag, bit 0 in element 3 (0 through 34 known).
Jun 11 13:33:46 2020 :: SYSERR: Object #1250 (an unfinished object) has unknown object affect flag, bit 31 in element 3 (0 through 34 known).
Attachment check_bitvector_names.txt not found