-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblock.cpp
More file actions
executable file
·58 lines (47 loc) · 1.17 KB
/
block.cpp
File metadata and controls
executable file
·58 lines (47 loc) · 1.17 KB
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
#include "block.h"
Block::Block(){
}
vector <GameObject*> Block::getObjects(){
vector <GameObject*> temp_objects;
for(unsigned int i=0; i<objects.size(); i++){
if(objects[i]!=NULL)
temp_objects.push_back(objects[i]);
}
if(temp_objects.size()==0)
temp_objects.push_back(NULL);
return temp_objects;
}
int Block::getRow(){
return row;
}
int Block::getCol(){
return col;
}
void Block::addObject(GameObject* object){
objects.push_back(object);
}
void Block::removeObject(GameObject *object){
for(unsigned int i=0; i<objects.size(); i++)
if(objects[i]==object)
objects[i]=NULL;
}
bool Block::getEmpty() const{
for(unsigned int i=0; i<objects.size(); i++)
if(objects[i]!=NULL)
return false;
return true;
}
bool Block::Empty_Of_Building(){
for(unsigned int i=0; i<objects.size(); i++)
if(objects[i]!=NULL)
if(objects[i]->getType()<4)
return false;
return true;
}
void Block::setPlace(int _row,int _col){
row=_row;
col=_col;
}
void Block::setEmpty(){
objects.clear();
}