forked from itsJonnyJyo/Chicken-Feet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfield.cpp
More file actions
49 lines (42 loc) · 834 Bytes
/
field.cpp
File metadata and controls
49 lines (42 loc) · 834 Bytes
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
#include <iostream>
#include <vector>
#include "field.h"
using namespace std;
//constructor/destructor
Field::Field() {}
Field::~Field()
{
for (auto it = field.begin(); it != field.end(); it++)
{
delete *it;
}
}
//mutator functions
void Field::addBone(Bone* aBone)
{
field.push_back(aBone);
}
bool Field::eachBone(unsigned int pos, Bone*& aBone)
{
cout << "TEST Field.size() " << field.size() << endl;
if(pos < 0 || pos >= field.size())
return false;
aBone = field.at(pos);
return true;
}
//accessor function
void Field::print() const
{
for (auto it = field.cbegin(); it != field.cend(); it++)
{
if(!(*it)->getTopUsed())
cout << "[" << (*it)->getTop() << "|";
else
cout << "[x|";
if(!(*it)->getBottomUsed())
cout << (*it)->getBottom() << "]";
else
cout << "x]";
}
cout << endl << endl;
}