Notably, the 3D bit arrays are now recognizable as such.
Also various formatting fixes, and removed some "unsigned"'s that were cluttering up the code.
ICVDXXH2Z5MV7BLYVWQNLQSV63THIB4E6NVORIDBB7D6TBEHBXOAC
const unsigned int num_cellrays = ray_coord_x.size();
const unsigned int num_words = (num_cellrays + LONGSIZE - 1) / LONGSIZE;
const int num_cellrays = ray_coord_x.size();
const int num_words = (num_cellrays + LONGSIZE - 1) / LONGSIZE;
blockrays_t full_los_blockrays;
// allocate and initialize
for (int x = 0; x <= LOS_MAX_RANGE; ++x)
for (int y = 0; y <= LOS_MAX_RANGE; ++y)
{
full_los_blockrays[x][y] = new unsigned long[num_words];
memset((void*)full_los_blockrays[x][y], 0, sizeof(unsigned long) * num_words);
los_blockrays[x][y] = new unsigned long[num_nondupe_words];
memset((void*)los_blockrays[x][y], 0, sizeof(unsigned long) * num_nondupe_words);
}
// every cell blocks...
unsigned long* const inptr = full_los_blockrays +
(ray_coord_x[i + cur_offset] * (LOS_MAX_RANGE_Y + 1) +
ray_coord_y[i + cur_offset]) * num_words;
// ...all following cellrays
int x = ray_coord_x[cur_offset + i];
int y = ray_coord_y[cur_offset + i];
// every cell blocks all following cellrays
unsigned long* oldptr = full_los_blockrays;
unsigned long* newptr = los_blockrays;
for (int x = 0; x <= LOS_MAX_RANGE_X; ++x)
for (int y = 0; y <= LOS_MAX_RANGE_Y; ++y)
{
for (unsigned int i = 0; i < num_nondupe_rays; ++i)
if (_get_bit_in_long_array(oldptr, nondupe_cellrays[i]))
_set_bit_in_long_array(newptr, i);
oldptr += num_words;
newptr += num_nondupe_words;
for (int x = 0; x <= LOS_MAX_RANGE; ++x)
for (int y = 0; y <= LOS_MAX_RANGE; ++y)
{
for (int i = 0; i < num_nondupe_rays; ++i)
if (_get_bit_in_long_array(full_los_blockrays[x][y],
nondupe_cellrays[i]))
_set_bit_in_long_array(los_blockrays[x][y], i);
memset( (void*)dead_rays, 0, sizeof(unsigned long) * num_words);
memset( (void*)smoke_rays, 0, sizeof(unsigned long) * num_words);
// kill all blocked rays
const unsigned long* inptr = los_blockrays;
memset((void*)dead_rays, 0, sizeof(unsigned long) * num_words);
memset((void*)smoke_rays, 0, sizeof(unsigned long) * num_words);