[AD] get_obj_count()

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Hey,

while working with this function, I noticed that it sometimes returns 1 too
much. After a little investigation, I found out that it also counts an
object with the name "GrabberInfo". I have changed my function to work
properly again by string-comparing the NAME property to "GrabberInfo" and
not counting it when it occurs. Is there a faster or easier way to detect
and avoid counting such invisible objects? Are there any other similar
extra-objects I need to be aware of?

Jörg

/****************************************
* get_obj_count
* determines the number of objects in a datafile
*****************************************/

int get_obj_count(DATAFILE *dat)
{
 int i = 0;

 while (dat->type != DAT_END)


   dat++;
  if (strcmp(get_datafile_property(dat, DAT_ID('N','A','M','E')),
"GrabberInfo") != 0)
   i++;
 }

 return i;
}



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/