if(debug >= DEBUG_LOW)log_info("Destroy actor. Max Actors is %d.\n", max_actors);
if(debug >= DEBUG_LOW)log_info("Destroy actor. Max Actors was %d.\n", max_actors);
void destroy_actor(int actor_id){     int i = 0;     struct kill_queue *tofree;          if(debug >= DEBUG_LOW)log_info("Destroy actor. Max Actors is %d.\n", max_actors);               for(i=0;i<max_actors;i++)		{			if(actors_list[i])				{                 	if(actors_list[i]->actor_id==actor_id)                 		{                                                        actors_list[i]->actor_id=NULL;	                        actors_list[i]->x_tile_pos=NULL;	                        actors_list[i]->y_tile_pos=NULL;	                        actors_list[i]->actor_type=NULL;                            actors_list[i]->fighting=NULL;                                                                                      if(actors_list[i]->k) {                                  tofree = actors_list[i]->k;                                  if(tofree->prev && tofree->next) {                                       tofree->prev->next = tofree->next;                                       tofree->next->prev = tofree->prev;                                  }                                 else if(!tofree->next && tofree->prev) {                                       last_node = tofree->prev;                                       tofree->prev->next = NULL;                                  }                                  else if(!tofree->prev && tofree->next) {                                       first_node = tofree->next;                                       tofree->next->prev = NULL;                                  }                                  else if(!tofree->prev && !tofree->next) {                                       first_node = NULL;                                       last_node = NULL;                                  }                                   tofree->prev=NULL;                                  tofree->next=NULL;                                  tofree->k=NULL;                                  tofree->time=NULL;                                  actors_list[i]->k = NULL;                                  free(tofree);                            }                                                                                          	                 		free(actors_list[i]);	                 		actors_list[i]=NULL;	                 		max_actors--;				            if(i<max_actors)						        {							         //copy the last one down and fill in the hole							         actors_list[i]=actors_list[max_actors];							         actors_list[max_actors]=NULL;						        }                        }                }        }        if(debug >= DEBUG_LOW)log_info("Finished destroying actor.\n");}