forked from yanntm/YoBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
WorkerData.h
44 lines (36 loc) · 1.49 KB
/
WorkerData.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
#include "Common.h"
class YoAgent;
namespace WorkerJobs
{
enum { Minerals, Gas, Build, Combat, Idle, Repair, Move, Scout, None, Num };
//STRING NAME[Num] { "Minerals", "Gas", "Build", "Combat", "Idle", "Repair", "Move", "Scout", "None", "Num" };
}
class WorkerData
{
YoAgent & m_bot;
std::set<const sc2::Unit *> m_workers;
std::set<const sc2::Unit *> m_depots;
std::map<int, int> m_workerJobCount;
std::map<const sc2::Unit *, int> m_workerJobMap;
std::map<const sc2::Unit *, int> m_refineryWorkerCount;
std::map<const sc2::Unit *, int> m_depotWorkerCount;
std::map<const sc2::Unit *, const sc2::Unit *> m_workerRefineryMap;
std::map<const sc2::Unit *, const sc2::Unit *> m_workerDepotMap;
void clearPreviousJob(const sc2::Unit * unit);
public:
WorkerData(YoAgent & bot);
void workerDestroyed(const sc2::Unit * unit);
void updateAllWorkerData();
void updateWorker(const sc2::Unit * unit);
void setWorkerJob(const sc2::Unit * unit, int job, const sc2::Unit * jobUnit = 0);
void drawDepotDebugInfo();
size_t getNumWorkers() const;
int getWorkerJobCount(int job) const;
int getNumAssignedWorkers(const sc2::Unit * unit);
int getWorkerJob(const sc2::Unit * unit) const;
const sc2::Unit * getMineralToMine(const sc2::Unit * unit) const;
const sc2::Unit * getWorkerDepot(const sc2::Unit * unit) const;
const char * getJobCode(const sc2::Unit * unit);
const std::set<const sc2::Unit *> & getWorkers() const;
};