forked from rubenwardy/NodeBoxEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Project.cpp
46 lines (41 loc) · 852 Bytes
/
Project.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
#include "Project.h"
Project::Project()
:number_of_nodes(0),snode(-1)
{
nodes = new list<Node*>();
}
Project::~Project(){
for(list<Node*>::ConstIterator Iterator = nodes->begin(); Iterator != nodes->end(); ++Iterator)
{
Node* n = *Iterator;
if (n)
delete n;
}
delete nodes;
}
Node* Project::GetNode(int id) const{
int a = 0;
for(list<Node*>::ConstIterator Iterator = nodes->begin(); Iterator != nodes->end(); ++Iterator)
{
Node* n = *Iterator;
if (n)
if (a == id){
return n;
}else{
a++;
}
}
return NULL;
}
Node* Project::GetNode(vector3di pos) const{
for(list<Node*>::ConstIterator Iterator = nodes->begin(); Iterator != nodes->end(); ++Iterator)
{
Node* n = *Iterator;
if (n && n->getPosition() == pos)
return n;
}
return NULL;
}
void Project::AddNode(Node* node) const{
nodes->push_back(node);
}