BWAPI
|
00001 #ifndef __MAPDATAREADER_H__ 00002 #define __MAPDATAREADER_H__ 00003 00004 #include "BaseAgent.h" 00005 00006 using namespace BWAPI; 00007 using namespace BWTA; 00008 using namespace std; 00009 00010 struct MapData { 00011 TilePosition basePos; 00012 TilePosition pos; 00013 int dist; 00014 00015 bool matches(TilePosition t1, TilePosition t2) { 00016 if (t1.x() == basePos.x() && t1.y() == basePos.y() && t2.x() == pos.x() && t2.y() == pos.y()) { 00017 return true; 00018 } 00019 return false; 00020 } 00021 }; 00022 00028 class MapDataReader { 00029 00030 private: 00031 vector<MapData> data; 00032 string mapName; 00033 00034 void saveFile(); 00035 bool loadFile(); 00036 string getFilename(); 00037 void addEntry(string line); 00038 int toInt(string &str); 00039 00040 public: 00042 MapDataReader(); 00043 00045 ~MapDataReader(); 00046 00048 void readMap(); 00049 00052 int getDistance(TilePosition t1, TilePosition t2); 00053 }; 00054 00055 #endif