//#include "AstarPathfinder.h"
//#include "ClientDatabase.h"
//#include "UnitList.h"
#define numlayers		1

class Map
{
private:
//need to make and area class that chang world to ares
	
string areaname;



	public:
		///need a unit list so we can draw and do conlistion on
	//	Unitlist units_in_area;
		string filename;
		string filename2;
Layer layers[numlayers];
//CharacterList npcs;
//UnitList units_in_area;
//CharacterList players;
 Map();
void redraw(View view,TileAnimeList );
void load();
//void edit(View);
//Layer *get_layers();

};
//end of Map

Map::Map()
{
//filename2= "npcs.txt"; //defalse
filename = "map1.txt";//defalse
//numberofNpcs = 4;
	//need this to be lodded from text file
/*
areaname = "wastland";
layers[0].set_filename("map1.dat");
layers[1].set_filename("map2.dat");
layers[2].set_filename("map3.dat");
layers[3].set_filename("map4.dat");
layers[0].set_masked(false);
layers[1].set_masked(true);
layers[2].set_masked(true);
layers[3].set_masked(true);
layers[0].load_layer();
layers[1].load_layer();
layers[2].load_layer();
layers[3].load_layer();
layers[0].layer_num=1;
layers[1].layer_num=2;
layers[2].layer_num=3;
layers[3].layer_num=4;
*/

//Sleep(10000);
}

void Map::load()
{


	ifstream inData;
	inData.open(filename.c_str());
	
	//char trash ;
	string num="";
	int num2 = 0;
			 

	inData >> num;

areaname = num;
	inData >> num;
layers[0].set_filename(num);
//	inData >> num;
//layers[1].set_filename(num);
//	inData >> num;
//layers[2].set_filename(num);
//	inData >> num;
//layers[3].set_filename(num);
	inData >> num;
filename2 = num;

	inData >> num2;
//numberofNpcs = num2;
	
	inData.close();
	

//numberofNpcs = 4;
	//need this to be lodded from text file

layers[0].set_masked(true);
//layers[1].set_masked(true);
//layers[2].set_masked(true);
//layers[3].set_masked(true);
layers[0].load_layer();
//layers[1].load_layer();
//layers[2].load_layer();
//layers[3].load_layer();
layers[0].layer_num=1;
//layers[1].layer_num=2;
///layers[2].layer_num=3;
//layers[3].layer_num=4;

//numberofNpcs = 4;
//filename2= "npcs.txt";

if (computerId== 0)
{

//	if(numberofNpcs >0)
	//{
	//	npcs.load(filename2); //load npcs	
	//}

}

}


void Map::redraw(View view,TileAnimeList animations)
{


	/*
	for( int i=0;i<numlayers;i++)
	{
		layers[i].update_layer(view);
		npcs.draw(layers[i].get_layerBitmap(),i+1,view);
		players.draw(layers[i].get_layerBitmap(),i+1,view);
		layers[i].draw_layer(view);
	}
	*/
layers[0].update_layer(view,animations,1);

//layers[1].update_layer(view,animations);
//layers[2].update_layer(view,animations);
//layers[3].update_layer(view,animations);

npcs.draw(layers[0].get_layerBitmap(),1,view);
layers[0].update_layer(view,animations,2);
npcs.draw(layers[0].get_layerBitmap(),2,view);
layers[0].update_layer(view,animations,3);
npcs.draw(layers[0].get_layerBitmap(),3,view);
layers[0].update_layer(view,animations,4);
npcs.draw(layers[0].get_layerBitmap(),4,view);
//npcs.draw(layers[1].get_layerBitmap(),2,view);
//npcs.draw(layers[2].get_layerBitmap(),3,view);
//npcs.draw(layers[3].get_layerBitmap(),4,view);
//players.draw(layers[0].get_layerBitmap(),1,view);
//players.draw(layers[1].get_layerBitmap(),2,view);
//players.draw(layers[2].get_layerBitmap(),3,view);
//players.draw(layers[3].get_layerBitmap(),4,view);

layers[0].draw_layer(view);
//layers[1].draw_layer(view);
//layers[2].draw_layer(view);
//layers[3].draw_layer(view);

}