-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathBuilding.cpp
38 lines (35 loc) · 1.11 KB
/
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 ()
, buildingUnit ()
, builderUnit ()
, lastOrderFrame (0)
, status (BuildingStatus::Unassigned)
, buildCommandGiven (false)
, underConstruction (false)
{}
// constructor we use most often
Building::Building(UnitType t, CCTilePosition desired)
: desiredPosition (desired)
, finalPosition (0,0)
, position (0,0)
, type (t)
, buildingUnit ()
, builderUnit ()
, 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);
}