|
BWAPI
|
00001 #pragma once 00002 00003 #include "defines.h" 00004 00005 class Task 00006 { 00007 protected: 00008 double _priority; 00009 00010 TaskTypeSet _types; 00011 00012 Environment* _env; 00013 AgentSet _agents; 00014 00015 TaskStatus _status; 00016 string _statusMessage; 00017 bool _canExecute; 00018 bool _needsMoreUnits; 00019 00020 string _name; 00021 int _id; 00022 int _creationFrame; 00023 int _execValidationFreq; 00024 00025 bool _canBePreempted; 00026 bool _filterTaskInfo; 00027 00028 bool _syncUp; 00029 00030 public: 00031 static TaskSet filterSet(TaskSet* tasks, TaskType type); 00032 static TaskSet filterSet(TaskSet* tasks, TaskType type, int maxCreationFrame); 00033 static TaskSet filterSetByPriority(TaskSet* tasks, TaskType type, double priority); 00034 00035 static double scalePriority(double value, double maxPriority, double minPriority); 00036 00037 Task(Environment* env, string name, bool canBePreempted = true, int execValidationFreq = DEFAULT_TASK_VALIDATION_FREQ); 00038 virtual ~Task(void); 00039 00040 virtual void cleanup(); 00041 00042 bool isType(TaskType); 00043 00044 double getPriority(); 00045 TaskStatus getStatus(); 00046 void setStatus(TaskStatus status); 00047 void setStatus(TaskStatus status, string statusMessage); 00048 00049 int getId(); 00050 string getName(); 00051 int getCreationFrame(); 00052 00053 int getExecValidationFreq(); 00054 00055 bool mustSyncUp(); 00056 00057 bool canBePreempted(); 00058 00059 virtual void calculatePriority() = 0; 00060 virtual void evaluateStatus() = 0; 00061 virtual void evaluateNeededUnits() = 0; 00062 00063 virtual double evaluateAptitude(Agent* agent) = 0; 00064 00065 bool needsMoreUnits(); 00066 bool canExecute(); 00067 string statusMessage(); 00068 00069 virtual bool execute(Agent* agent) = 0; 00070 00071 virtual void addAgent(Agent* agent); 00072 virtual void removeAgent(Agent* agent); 00073 00074 void assignNeededAgents(AgentMap* agents); 00075 00076 virtual void displayInfo(int &row, Agent* agent); 00077 };
1.7.6.1