forked from yanntm/YoBot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Building.cpp
38 lines (35 loc) · 944 Bytes
/
Building.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
#include "Building.h"
Building::Building()
: desiredPosition(0, 0)
, finalPosition(0, 0)
, position(0, 0)
, type(0)
, buildingUnit(nullptr)
, builderUnit(nullptr)
, lastOrderFrame(0)
, status(BuildingStatus::Unassigned)
, buildCommandGiven(false)
, underConstruction(false)
{}
// constructor we use most often
Building::Building(sc2::UnitTypeID t, sc2::Point2D desired)
: desiredPosition(desired)
, finalPosition(0, 0)
, position(0, 0)
, type(t)
, buildingUnit(nullptr)
, builderUnit(nullptr)
, lastOrderFrame(0)
, status(BuildingStatus::Unassigned)
, buildCommandGiven(false)
, underConstruction(false)
{}
// equals operator
bool Building::operator == (const Building & b)
{
// buildings are equal if their worker unit and building unit are equal
return (b.buildingUnit == buildingUnit)
&& (b.builderUnit == builderUnit)
&& (b.finalPosition.x == finalPosition.x)
&& (b.finalPosition.y == finalPosition.y);
}