forked from kyonshi/grenzland-mud
GitHub issues 78 79 81 num aff flags off by one (#82)
* Make sure all followers are free'd before freeing the character list Otherwise, the followers structs will point to free'd memory and the stop_follower call will attempt to dereference a free'd characters' followers list. * https://github.com/tbamud/tbamud/issues/79 typo * https://github.com/tbamud/tbamud/issues/81 nullpointer crash on syntax check run * NUM_AFF_FLAGS fix. Now, consistently, the NUM_AFF_FLAGS is used in the same way as other NUM_* variables. Specifically, the the number is consistent with how others are defined - 1 above the highest in the list. I would like to have removed the need to start from 1 instead of 0 as well, but the loading mechanism, and thus potentially a lot of existing object files, use 0 as a marker for "no flags set", and we can't easily fix that. So, the places we loop through the list, we still need to make sure we're stying within the [1;NUM_AFF_FLAGS) interval. Simultaneously, I've checked over the other flags, and it seems like the usage is pretty consistent there. Fixes https://github.com/tbamud/tbamud/issues/78
This commit is contained in:
@@ -847,7 +847,7 @@ static void load_affects(FILE *fl, struct char_data *ch)
|
||||
af.bitvector[2] = num7;
|
||||
af.bitvector[3] = num8;
|
||||
} else if (n_vars == 5) { /* Old 32-bit conversion version */
|
||||
if (num5 > 0 && num5 <= NUM_AFF_FLAGS) /* Ignore invalid values */
|
||||
if (num5 > 0 && num5 < NUM_AFF_FLAGS) /* Ignore invalid values */
|
||||
SET_BIT_AR(af.bitvector, num5);
|
||||
} else {
|
||||
log("SYSERR: Invalid affects in pfile (%s), expecting 5 or 8 values", GET_NAME(ch));
|
||||
|
||||
Reference in New Issue
Block a user