Here is a drop in fix so you guys don't have to change your ent_next code.

Code:
ENTITY *__ent_next_fixed(ENTITY *ent)
{
	while((ent = ent_next(ent)))
	{
		if(ent->type != NULL)
			return ent;
	}
	
	return NULL;
}

#define ent_next __ent_next_fixed



Edit: Just remembered that Lite-C has result as reserved keyword and that it doesn't support early termination of expressions... Oh well, there goes the elegant function.

Edit 2: Added some elegance back

Edit 3: In case Lite-C ever supports it, here is a elegant three liner:
Code:
ENTITY *__ent_next_fixed(ENTITY *ent)
{
	while((ent = ent_next(ent)) && ent->type == NULL)
		;
	
	return ent;
}


Last edited by WretchedSid; 04/09/15 13:04.

Shitlord by trade and passion. Graphics programmer at Laminar Research.
I write blog posts at feresignum.com