BWAPI
|
00001 #pragma once 00002 00003 #include "Interface.h" 00004 00005 #include "Base.h" 00006 #include "Unit.h" 00007 #include "TypeSafeEnum.h" 00008 00009 struct ScoutTypeDef 00010 { 00011 enum type 00012 { 00013 None, 00014 FailedWithGroundLow, 00015 FailedWithGroundHigh, 00016 FailedWithAir, 00017 CouldNotReachWithGround, 00018 InitialBaseLocationScout, 00019 BaseScout, 00020 TechSearch, 00021 BaseSearch, 00022 PerimeterSearch, 00023 ThoroughSearch 00024 }; 00025 00026 static std::string getName(type t) 00027 { 00028 switch(t) 00029 { 00030 case None: 00031 return std::string("None"); 00032 case FailedWithGroundLow: 00033 return std::string("Failed With Ground Low"); 00034 case FailedWithGroundHigh: 00035 return std::string("Failed With Ground High"); 00036 case FailedWithAir: 00037 return std::string("Failed With Air"); 00038 case CouldNotReachWithGround: 00039 return std::string("Failed To Reach Ground"); 00040 case InitialBaseLocationScout: 00041 return std::string("Initial BaseLocation Scout"); 00042 case BaseScout: 00043 return std::string("Base Scout"); 00044 case TechSearch: 00045 return std::string("Tech Search"); 00046 case BaseSearch: 00047 return std::string("Base Search"); 00048 case ThoroughSearch: 00049 return std::string("Thorough Search"); 00050 case PerimeterSearch: 00051 return std::string("Perimeter Search"); 00052 } 00053 return std::string("Unknown"); 00054 } 00055 }; 00056 typedef SafeEnum<ScoutTypeDef> ScoutType; 00057 00058 struct ScoutUnitTypeDef 00059 { 00060 enum type 00061 { 00062 Worker, 00063 Observer, 00064 Overlord, 00065 Scan 00066 }; 00067 }; 00068 typedef SafeEnum<ScoutUnitTypeDef> ScoutUnitType; 00069 00070 class ScoutDataClass 00071 { 00072 public: 00073 ScoutDataClass(); 00074 ScoutDataClass(Base base, ScoutType type); 00075 00076 void update(); 00077 00078 bool isAchieved(); 00079 00080 Position getNextPosition(Position pos = BWAPI::Positions::None); 00081 Position getLastPosition(Position pos = BWAPI::Positions::None); 00082 double getDistance(Unit unit); 00083 00084 Base getBase() { return mBase; } 00085 ScoutType getType() { return mType; } 00086 00087 void drawDebug(BWAPI::Color colour); 00088 00089 private: 00090 ScoutType mType; 00091 Base mBase; 00092 00093 std::set<Position> mPositions; 00094 00095 void loadPositions(); 00096 void checkPositions(); 00097 }; 00098 00099 typedef std::tr1::shared_ptr<ScoutDataClass> ScoutData;