#ifndef _LOADER_H_
#define _LOADER_H_

#include "allegro.h"
#include "Round.h"
#include "UnitTemplate.h"
#include "Campaign.h"
#include "MusicSound.h"
#include <vector>
#include <string>
using namespace std;

//implement dontExist later...

//read the general file to know which campaign files to read
//tell the Loader* objects what to load
//choose which unit's files have already been loaded (caching?)
//talk to LoadRound when the round is over.

class StartGameConfig;

class Loader {
 public:
  Loader ();

  int loadCampaign (Campaign &);
  int addPC (const string & pcName);
  int loadRound (Campaign &, int, Round *, const string &, MusicSound * ms);
  int loadAllUnitsFromCampaign (Campaign &);
  string * dontExist (const string &);
  int setUpUnitTemplate (const string &);
  vector <UnitTemplate *> * getUnitTemplates ();
  UnitTemplate * getUnitTemplate (string &);
  int addUnit (const string &);
  void loadUnitProperties (UnitTemplate *);
  bool loadAnimation (UnitTemplate *, const string & uN);

  void get_argv (vector <string> * ans, string * section, string * name, int * argc);

  int loadGeneralData ();
  BITMAP * getMouseCursor ();
  vector <BITMAP *> * getGoodStatusPics ();  
  vector <BITMAP *> * getBadStatusPics ();
  BITMAP * getYouWinPic ();
  BITMAP * getYouLosePic ();

  int loadCharAndCamp (StartGameConfig * sgc);

  void unloadAll ();
  ~Loader ();

 protected:

  //campaign
  DATAFILE * lcDataFile;
  DATAFILE * roundDataFile;
  char * campaignDatafile;
  char * roundDatafile;

  vector <string *> * unitName;
  vector <DATAFILE *> * unitDataFile;
  vector <UnitTemplate *> * unitTemplates;

  vector <BITMAP *> * goodStatusPics;
  vector <BITMAP *> * badStatusPics;

  DATAFILE * generalDatafile;
  BITMAP * mouseCursor;

  BITMAP * youWinPic;
  BITMAP * youLosePic;

  char ** superData;

  int colDepth;
};

#endif
