#ifndef _LIST_H_
#define _LIST_H_

#include "c_entity.h"

/*
Node class :
Each node in the linked list points to an entity (abstract base class).
*/
class NODE {
 public:
  ENTITY *item;
  NODE *next, *prev;
};

/*
Linked list class:
This is a double linked list that handles the list of entities.
It allows for entities to remove themselves from the list (by the
entity setting its "remove" flag) and also provides support for
collision detection by calling "entity1->collide(entity2)" for every
combination of entities.
*/
class LIST {
  private:
   NODE *first, *last;
   int count;
  public:
   LIST( );
   void add( ENTITY *item );
   void remove( NODE *node );
   void remove_all( );
   void draw_all( );
   void move_all( );
   void remove_dead_nodes( );
   void unlink_entity( ENTITY *item );
   void check_collisions( );
};

#endif

/* END */
