|
BWAPI
|
00001 #pragma once 00002 00003 #include "Common.h" 00004 #include "MetaType.h" 00005 00006 class BuildOrderGoalItem 00007 { 00008 // the MetaType to be constructed 00009 MetaType _metaType; 00010 00011 // the number we wish to construct 00012 int _num; 00013 00014 public: 00015 00016 // constructor 00017 BuildOrderGoalItem(const MetaType & t, const int n) : _metaType(t), _num(n) {} 00018 00019 // getters 00020 const MetaType & metaType() const { return _metaType; } 00021 const int num() const { return _num; } 00022 00023 00024 }; 00025 00026 class BuildOrderGoal 00027 { 00028 // the goals 00029 std::vector<BuildOrderGoalItem> goal; 00030 00031 // priority 00032 int priority; 00033 00034 public: 00035 00036 BuildOrderGoal() : priority(0) {} 00037 BuildOrderGoal(const int p) : priority(p) {} 00038 ~BuildOrderGoal() {} 00039 00040 void addItem(const BuildOrderGoalItem & bogi) 00041 { 00042 goal.push_back(bogi); 00043 } 00044 00045 void setPriority(const int p) 00046 { 00047 priority = p; 00048 } 00049 00050 const int getPriority() const 00051 { 00052 return priority; 00053 } 00054 00055 const std::vector<BuildOrderGoalItem> & getGoal() const 00056 { 00057 return goal; 00058 } 00059 00060 bool operator < (const BuildOrderGoal & bog) 00061 { 00062 return getPriority() < bog.getPriority(); 00063 } 00064 }; 00065 00066 class BuildOrderGoalManager { 00067 00068 std::vector<BuildOrderGoal> goals; 00069 00070 // add a build order goal item with a priority 00071 void addGoal(const MetaType t, int num, int p); 00072 00073 // checks to see if a goal is completed by using BWAPI data 00074 bool isCompleted(const BuildOrderGoal & bog) const; 00075 00076 // set the build order goals based on expert knowledge 00077 void setBuildOrderGoals(); 00078 00079 public: 00080 00081 BuildOrderGoalManager(); 00082 ~BuildOrderGoalManager(); 00083 00084 // gets the highest priority goal which isn't completed 00085 BuildOrderGoal & getNextBuildOrderGoal() const; 00086 };
1.7.6.1