-
Notifications
You must be signed in to change notification settings - Fork 0
/
temp.h
54 lines (49 loc) · 1.1 KB
/
temp.h
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
#include "data/data.h"
#include "data/map_data/map_data.h"
#include <fstream>
#include <string>
#include <sstream>
using namespace std;
void TEMP_load_map(map_data& DATA) {
string word = "";
ifstream readFile;
readFile.open("maps/map1.map");
if (readFile.is_open()) {
int y = 0;
while (!readFile.eof()) { // while there is still data
readFile >> word;
int x = 0;
while (word[x]!=0) {
switch (word[x]-48) {
case 0:
DATA.map[y][x] = tile('.',0);
break;
case 1:
DATA.map[y][x] = tile(' ',9);
DATA.map[y][x].set_blocks_vision(true);
DATA.map[y][x].set_passability(false);
break;
case 2:
DATA.map[y][x] = tile('_',3);
DATA.map[y][x].set_is_door(true);
break;
case 3:
DATA.map[y][x] = tile('/',3);
DATA.map[y][x].set_blocks_vision(true);
DATA.map[y][x].set_is_door(true);
DATA.map[y][x].set_passability(false);
break;
case 7:
DATA.map[y][x] = tile('*',3);
break;
default:
DATA.map[y][x] = tile('.',4);
}
x++;
}
y++;
}
word = "";
}
readFile.close();
}