#ifndef _UNITLIST_H_
#define _UNITLIST_H_

#include "allegro.h"
#include "InputObj.h"
//#include "Round.h"
#include "MusicSound.h"
#include "UnitCreate.h"
#include "UnitTemplate.h"
#include "Loader.h"
#include "Campaign.h"

#include <vector>
#include <string>
using namespace std;

class Unit;
class Round;
class PlayerUnit;

//to tell each unit subobject to resolve itself
//tells loader to load objects
//tell each unit to draw itself
//tell arena to draw itself
//call each unit to do stuff to itself
//create all unitCreate objects that are on time.
//to sort and search through the list of availible units
//remove expired units
//to judge if win/lose conditions have been met

class UnitList {
 public:
  UnitList ();

  void allUnitsMove (InputObj *, MusicSound *, Loader *);
  void makeUnits (Loader *, Round *, InputObj * iO);
  void positionUnitOnSide (fixed &, fixed &, fixed &, UnitCreate *, UnitTemplate *, Round *);
  void drawUnits (BITMAP *, MusicSound *, bool);
  void setupRound (Round *);
  void clear ();
  void addUnitCreate (UnitCreate *);
  void giveJuiceToPlayer (PlayerUnit *);
  vector <Unit *> * search (int, int);
  bool thisUnitExists (Unit *);
  bool anyRemainingAffiliation (int affil, Loader *);
  int getPlayerScore ();

  ~UnitList ();

  vector <Unit *> :: iterator beginOfList ();
  vector <Unit *> :: iterator endOfList ();

 protected:
  vector <Unit *> * units;
  InputObj * iO;
  vector <UnitCreate *> * uC;
  Round * rndInProgress;
};

#endif
