-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWall.cpp
52 lines (42 loc) · 1.27 KB
/
Wall.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
47
48
49
50
51
52
/*
@author: Sir0ga90
@version: 0.1
*/
#include "Wall.h"
//======================================================================//Constructors
Wall::Wall() : form{0}{}
Wall::Wall(p_size h, p_size w){
hig = h;
wid = w;
}
Wall::~Wall(){}
//======================================================================//
Index::Index(int raws, int lines){
i = raws;
j = lines;
}
//======================================================================//Member func's
void Wall::set_size(p_size h, p_size w){
hig = h;
wid = w;
}
//======================================================================//
/*
return cell-value by index
in: ind - index of needed cell
*/
Cell Wall::get_cell(Index ind){
int first_ln = 0; // line for taking wide of wall
if (ind.i > form.size() ||
ind.j > form.at(first_ln).size())
throw exception("get_cell(): cell not in bound of wall\n");
return form.at(ind.i).at(ind.j);
}
//======================================================================//
void Wall::zero_out_cell(Index ind){
int first_ln = 0; // line for taking width of wall
if (ind.i > form.size() ||
ind.j > form.at(first_ln).size())
throw exception("zero_out_cell(): not in bound of wall\n");
form.at(ind.i).at(ind.j) = HOLE;
}