This repository has been archived by the owner on Jun 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.cpp
79 lines (68 loc) · 1.43 KB
/
map.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef MAP_cpp_
#define MAP_cpp_
#include<iostream>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<queue>
const int MAP_X = 25;
const int MAP_Y = 11;
int mapB[MAP_X+1][MAP_Y+1] = {}; // Ìùͼ
int mapC[MAP_X+1][MAP_Y+1] = {}; // 񅧏
void map_init() {
for(int i = 1; i <= MAP_X; i++)
mapB[i][1] = mapB[i][2] = mapB[i][MAP_Y] = mapB[i][MAP_Y-1] = 1;
for(int i = 1; i <= MAP_Y; i++)
mapB[1][i] = mapB[2][i] = mapB[MAP_X][i] = mapB[MAP_X-1][i] = 1;
/*
mapB[20][5] = 1;
mapB[20][6] = 1;
mapB[20][7] = 1;
mapB[20][8] = 1;
mapB[20][9] = 1;
mapB[21][8] = 1;
mapB[21][9] = 1;
mapB[21][10] = 1;
mapB[22][7] = 1;
mapB[22][8] = 1;
mapB[22][9] = 1;
mapB[22][10] = 1;
*/
//mapB[10][7] = 1;
//mapB[11][7] = 1;
//mapB[10][8] = 1;
//mapB[11][8] = 1;
mapB[12][3] = 2;
mapB[12][4] = 2;
mapB[12][5] = 2;
mapB[12][6] = 2;
mapB[12][7] = 2;
mapB[12][8] = 2;
mapB[12][9] = 2;
mapB[11][3] = 2;
mapB[11][5] = 2;
mapB[11][6] = 2;
mapB[10][4] = 2;
mapB[10][5] = 2;
mapB[10][6] = 2;
for(int i = 1; i <= MAP_X; i++)
for(int j = 1; j <= MAP_Y; j++)
if(mapB[i][j] == 1)
mapC[i][j] = -1;
}
bool map_reach(int x, int y) {
if(mapC[x][y] != 0) return false;
if(mapB[x][y] == 1) return false;
return true;
}
/*
mapB:
0 light green glass
1 stone
2 green glass
mapC:
-1 unpassable (stone)
0 passable
>0 unpassable (character)
*/
#endif