-
Notifications
You must be signed in to change notification settings - Fork 0
/
MapCell.cpp
117 lines (89 loc) · 3.34 KB
/
MapCell.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#include "MapCell.h"
#include <iostream>
#include <unordered_map>
#include <utility> // For std::pair
int MapCell::m_theMap[178];
int MapCell::m_defaultMap[178] = { 9,9,9,9,9,9,9,9,9,9,
9,0,0,0,0,0,0,0,0,0,9,
0,2,2,2,2,2,0,2,2,0,
9,2,0,0,4,0,2,0,0,2,9,
0,0,0,0,0,0,0,0,0,0,
9,2,0,0,2,0,4,0,0,2,9,
0,0,0,2,2,2,2,2,4,0,
9,0,0,4,0,0,0,2,0,2,9,
0,0,0,0,0,0,0,0,0,0,
9,2,0,2,0,0,0,4,0,0,9,
0,2,2,2,4,2,2,2,2,0,
9,2,0,0,0,0,2,0,2,2,9,
0,0,0,0,0,0,0,0,0,0,
9,2,0,0,0,0,4,0,4,2,9,
0,2,2,0,2,2,2,2,2,0,
9,0,0,0,0,0,0,0,0,0,9,
9,9,9,9,9,9,9,9,9,9 };
int MapCell::m_theWalls[178] = { 0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,
0,1,2,3,4,5,0,6,7,0,
0,8,0,0,0,0,9,0,0,10,9,
0,0,0,0,0,0,0,0,0,0,
0,11,0,0,12,0,0,0,0,13,0,
0,0,0,14,15,16,17,18,0,0,
0,0,0,0,0,0,0,19,0,20,0,
0,0,0,0,0,0,0,0,0,0,
0,21,0,22,0,0,0,0,0,0,0,
0,23,24,25,0,26,27,28,29,0,
0,30,0,0,0,0,31,0,32,33,0,
0,0,0,0,0,0,0,0,0,0,
0,34,0,0,0,0,0,0,0,35,0,
0,36,37,0,38,39,40,41,42,0,
0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0 };
MapCell::MapCell()
{}
MapCell::MapCell(int gridLocation)
: fire(false), smoke(false), hazmat(false), hotSpot(false), id(gridLocation)
{}
MapCell::~MapCell()
{}
bool MapCell::getSmoke()
{return smoke;}
bool MapCell::getFire()
{return fire;}
int MapCell::getID()
{return id;}
void MapCell::setSmoke(bool iSmoke)
{ smoke = iSmoke;}
void MapCell::setFire(bool iFire)
{fire = iFire;}
void MapCell::printBoard()
{
int slot = 0;
for (int i =0; i<9; i++)
{
std::cout << " ";
for (int j=0; j<10; j++)
{
std::cout << m_theMap[slot] << " ";
slot ++;
}
std::cout << "\n";
if (i<8)
{
for (int k=0; k<11; k++)
{
std::cout << m_theMap[slot] << " ";
slot ++;
}
std::cout << "\n";
}
}
std::cout << "\n";
}
int* MapCell::getMapArray()
{
memcpy(m_theMap, m_defaultMap, sizeof(m_theMap));
return m_theMap;
}
int* MapCell::getWallArray()
{
return m_theWalls;
}