The second linked-list for stopping the action feels like overkill to me. It seems to complicate the linked lists alot to controll something that dosn't need a second list. It would probably be easier to set a skill to 1 when creating/recycling an entity, and setting that skill to 0 when adding to the "inactive list", then in the function that acts like a "fake action" instead of using a while(1) and a return just use a simple while condition that uses that skill.
Code:
void False_Action(ENTITY* ME)
{
   me=ME;
   my.emask |= (ENABLE_BLOCK | ENABLE_ENTITY);
   my.event = blablabla_event;

   while(my.skill25==1)
   {
      //do whatever the action would do
      wait(1);
   }

}


This would remove the need for a second linked-list, and it would also avoid the need for the linked lists to be dual (or bi-directional) for searches. That way you could keep the list working like a simple stack as in my previous post's example.

About the actions: I see how a function recieving a ent pointer could substitute an action. But how do I tell my ent_create_2 function which function it needs to run for the ent? is there any way to set a pointer to a function and pass that as a parameter to my ent_create_2()? Or to use a string containing the funtion name to use some macro to run a function?

About the events: I havn't tested it but it seems with that function acting as an action it should be possible to set the events and all... But how would I invert the process later when recycling the entity to remove its events? the my.event could be easily redirected to an empty "dummy" event function and reset later to whatever new event function the ent needs. But how would I know what flags were previously enabled to disable them? (like ENABLE_BLOCK or ENABLE_ENTITY)



EDIT: Being so busy is a good sighn. It means 1.You enjoy what you do, and 2.you are good at what you do

wink



Last edited by Carlos3DGS; 10/31/11 21:05.

"The more you know, the more you realize how little you know..."

I <3 HORUS
http://www.opserver.de/ubb7/ubbthreads.php?ubb=showflat&Number=401929&page=1