suggestions:
idea behind these is that I want to add entities to a list.
given any one entity I want to then find the next and the previous entity in the list easily. Sorry, I don't see a way of doing it without these functions
//change this to return the index of the newly added element:
int ll_list_add(LL_LIST* self, void* data);
//returns the element with the current index
//returns NULL if element with index not found.
LL_LIST_ELEM* ll_list_find(LL_LIST* self, int index);
//of course the second function would require that the object is not yet in the list.
the implementation I would then use would be something like this:
my.listIndex = ll_list_add(ll_entity_list, my );
//...
//...
LL_LIST_ELEM* currentElement;
currentElement = ll_list_find(targetEnt.listIndex);
while(currentElement != NULL)
{
if(isMyEnemey(currentElement.data) == ON) break;
currentElement = currentElement.next;
}
if(currentElement != NULL)
targetEnt = currentEnt.data;
Or is there some easier way?