-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMap.cpp
More file actions
59 lines (52 loc) · 984 Bytes
/
Map.cpp
File metadata and controls
59 lines (52 loc) · 984 Bytes
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
#include "Map.h"
#include "Input.h"
int Map::Clear()
{
huihe = 1;
for (int i = 0; i < 7; i++) {
for (int j = 0; j < 7; j++) {
map[i][j] = Map_None;
}
}
return 0;
}
int Map::CreateMap()
{
huihe = 0;
return 0;
}
int Map::Update(Point* point_, int flag_player_, bool flag_)
{
huihe++;
if (flag_) {
auto point = &map[point_->x - 1][point_->y - 1];
point->zhan_Point = ZHAN;
point->flag_player = flag_player_;
point->huihe = huihe;
}
return 0;
}
int Map::Gethuihe()
{
return huihe;
}
Map_Point Map::GetMapState(Point* point_)
{
return map[point_->x - 1][point_->y - 1];
}
Map_Point Map::GetMapStatexy(int x, int y)
{
x -= 1;
y -= 1;
if (x < 0 || x > 6 || y < 0 || y > 6) { return{ ZHAN,0,0 }; }
return map[x][y];
}
bool Map::IsThoughLine(int x1, int y1, int x2, int y2)
{
Map_Point point1 = map[x1][y1];
Map_Point point2 = map[x2][y2];
if (point1.huihe - point2.huihe == -2 || point1.huihe - point2.huihe == 2) {
return true;
}
return false;
}