forked from yanntm/YoBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BuildType.cpp
81 lines (67 loc) · 1.37 KB
/
BuildType.cpp
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include "BuildType.h"
#include "Util.h"
//#include "CCBot.h" //replace with YoBot or YoAgent??
BuildType::BuildType()
: m_type(BuildTypes::None)
, m_name("BuildType")
, m_race(sc2::Race::Random)
, m_unitType(0)
, m_upgrade(0)
{
}
BuildType::BuildType(const std::string & name, sc2::Agent & bot)
: BuildType()
{
m_name = name;
m_unitType = Util::GetUnitTypeIDFromName(m_name, bot);
if (m_unitType)
{
m_type = BuildTypes::Unit;
return;
}
m_upgrade = Util::GetUpgradeIDFromName(m_name, bot);
if (m_upgrade)
{
m_type = BuildTypes::Upgrade;
return;
}
//BOT_ASSERT(false, "Could not find BuildType with name: %s", name.c_str());
}
BuildType::BuildType(const sc2::UnitTypeID & unitType)
{
m_type = BuildTypes::Unit;
m_unitType = unitType;
}
BuildType::BuildType(const sc2::UpgradeID & upgradeType)
{
m_type = BuildTypes::Upgrade;
m_upgrade = upgradeType;
}
const size_t & BuildType::getBuildType() const
{
return m_type;
}
bool BuildType::isUnit() const
{
return m_type == BuildTypes::Unit;
}
bool BuildType::isUpgrade() const
{
return m_type == BuildTypes::Upgrade;
}
const sc2::Race & BuildType::getRace() const
{
return m_race;
}
const sc2::UnitTypeID & BuildType::getUnitTypeID() const
{
return m_unitType;
}
const sc2::UpgradeID & BuildType::getUpgradeID() const
{
return m_upgrade;
}
const std::string & BuildType::getName() const
{
return m_name;
}