-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmap.cpp
60 lines (51 loc) · 1.25 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
#include "map.h"
template <class T>
void copyVector(const T (&fromVec)[sizey][sizex], T (&toVec)[sizey][sizex])
{
for(int i = 0; i < sizey; i++)
{
for(int j = 0; j < sizex; j++)
{
toVec[i][j] = fromVec[i][j];
}
}
}
Map::Map()
{
}
Map::Map(const Map& map)
{
copyVector(map.discovered, this->discovered);
copyVector(map.onTop, this->onTop);
copyVector(map.tiles, this->tiles);
copyVector(map.blocks, this->blocks);
copyVector(map.word, this->word);
copyVector(map.f_r, this->f_r);
copyVector(map.f_g, this->f_g);
copyVector(map.f_b, this->f_b);
copyVector(map.b_r, this->b_r);
copyVector(map.b_g, this->b_g);
copyVector(map.b_b, this->b_b);
copyVector(map.extra, this->extra);
this->rooms = std::vector<Room>(map.rooms);
this->treasures = std::list<Treasure>(map.treasures);
this->traps = std::list<Trap>(map.traps);
}
void Map::updateOnTop()
{
for(int y =0; y < sizey; y++)
{
for(int x =0; x < sizey; x++)
{
onTop[y][x] = None;
}
}
for(Treasure& treasure: treasures)
{
onTop[treasure.y][treasure.x] = TreasureTile;
}
for(Trap& trap: traps)
{
onTop[trap.y][trap.x] = TrapTile;
}
}