howdy,
the subject pretty much says it all. I had been developing a rot based
game for a while online and then opened it up and a few players
started coming and experimenting and whatnot, but then suddenly it
would crash and it check the core file and the last events occuring in
the code seemed harmless enough, will run fine up until the random
crash.
I suppose the crash wasn't completely random on second though. I had
put in the infinite bit 2.1 by runter and it was crashing on lines
like:
Sperhaps it was one of the functions I had added to make handling
bitmasks easier(IMO), maybe someone might find them handy, and
hopefully someone might find a source to my memory leak, so here are
teh functions(sorry, dont mean to ask to debug my code, but I've
looked at this stuff many times now and the memory leak is
consistently in regarding bitmasks.):
this is assuming runters code is clean...so if someone has seen it
before perhaps you can spot an obvious error or two or three(btw I
found it VERY helpful, runters infinite bits snippet that is)
void clear_bitmask(BITMASK *mask)
{
free_bitmask(mask);
init_bitmask(mask);
return;
}
//I wrote set_bit_list to take one bitmask, and copies itself over to the other
//however it won't remove any previously set bits...sorta super-imposes 1 over 2
void set_bit_list(BITMASK *mask, BITMASK *mask2)
{
BMlist *pBlist;
init_bitmask(mask2);
for(pBlist = mask2->int_list;pBlist;pBlist = pBlist->next)
set_bit(mask,pBlist->tar_mask);
free_bitmask(mask2);
return;
}
void copy_bitmask(BITMASK to, BITMASK *from)
{
BITMASK mask;
BMlist *pBlist;
for(pBlist = to.int_list;pBlist;pBlist = pBlist->next)//remove all the bits
remove_bit(&to,pBlist->tar_mask);
init_bitmask(&mask);
for(pBlist = from->int_list;pBlist;pBlist = pBlist->next)//add the new ones
set_bit(&mask,pBlist->tar_mask);
to = mask;
return;
}
void toggle_bit( BITMASK *mask, sh_int bit )
{
if(is_set(mask,bit))
remove_bit(mask,bit);
else
set_bit(mask,bit);
return;
}
//I used long_to_bitmask to convert flags to infinite bits
automatically for old data files that needed to be loaded, races,
classes, areas, etc..
void long_to_bitmask( long list, BITMASK *mask )
{
int i;
for(i=0;i<31;i++)
if( IS_SET(list,affect2_flags[i].bit_let) )
{
i = affect2_flags[i].bit_num;
set_bit(mask,i);
}
return;
}