-
Notifications
You must be signed in to change notification settings - Fork 0
/
objPos.cpp
60 lines (50 loc) · 830 Bytes
/
objPos.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
53
54
55
56
57
58
59
60
#include "objPos.h"
objPos::objPos()
{
x = 0;
y = 0;
symbol = 0; //NULL
}
objPos::objPos(objPos &o)
{
x = o.x;
y = o.y;
symbol = o.symbol;
}
objPos::objPos(int xPos, int yPos, char sym)
{
x = xPos;
y = yPos;
symbol = sym;
}
void objPos::setObjPos(objPos o)
{
x = o.x;
y = o.y;
symbol = o.symbol;
}
void objPos::setObjPos(int xPos, int yPos, char sym)
{
x = xPos;
y = yPos;
symbol = sym;
}
void objPos::getObjPos(objPos &returnPos)
{
returnPos.setObjPos(x, y, symbol);
}
char objPos::getSymbol()
{
return symbol;
}
bool objPos::isPosEqual(const objPos* refPos)
{
return (refPos->x == x && refPos->y == y);
}
char objPos::getSymbolIfPosEqual(const objPos* refPos)
{
if(isPosEqual(refPos))
return getSymbol();
else
return 0;
}