root / trunk / code / projects / colonet / server / VirtualWall.cpp @ 659
History | View | Annotate | Download (812 Bytes)
1 |
/**
|
---|---|
2 |
* Eugene Marinelli
|
3 |
*/
|
4 |
|
5 |
#include <VirtualWall.h> |
6 |
|
7 |
VirtualWall::VirtualWall(void) {
|
8 |
wall_available = false;
|
9 |
} |
10 |
|
11 |
VirtualWall::~VirtualWall(void) {
|
12 |
} |
13 |
|
14 |
int VirtualWall::set_coordinates(int upper_x, int upper_y, int lower_x, int lower_y) { |
15 |
if (upper_x < 0 || upper_y < 0 || lower_x < 0 || lower_y < 0) { |
16 |
return -1; |
17 |
} |
18 |
|
19 |
upper_left_x = upper_x; |
20 |
upper_left_y = upper_y; |
21 |
lower_right_x = lower_x; |
22 |
lower_right_y = lower_y; |
23 |
|
24 |
wall_available = true;
|
25 |
|
26 |
return 0; |
27 |
} |
28 |
|
29 |
void VirtualWall::clear() {
|
30 |
wall_available = false;
|
31 |
} |
32 |
|
33 |
int VirtualWall::get_coordinates(int* upper_x, int* upper_y, int* lower_x, int* lower_y) { |
34 |
if (wall_available) {
|
35 |
*upper_x = upper_left_x; |
36 |
*upper_y = upper_left_y; |
37 |
*lower_x = lower_right_x; |
38 |
*lower_y = lower_right_y; |
39 |
|
40 |
return 0; |
41 |
} else {
|
42 |
return -1; |
43 |
} |
44 |
} |