-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBoard.cpp
More file actions
100 lines (89 loc) · 2.29 KB
/
Board.cpp
File metadata and controls
100 lines (89 loc) · 2.29 KB
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
/**
* Authors @authors: Alysha Aul, Nandhitha Krishnan, Paul Rodgers, Nouran Sakr, Chun Yang
* Date: November 7, 2023
* Purpose @brief: To create an object class to store the board.
*/
#include "Board.h"
void Board::initCampusMap() {
campusMap = LevelMap(1);
}
/**
* This will get the map type.
* @brief: This will return the map type
* @returns: maptype
*/
int Board::getMapType(){
// 0 - classic map
// 1 - campus map
return mapType;
}
/**
* This will get the main map
* @brief: This will get the main map or the campus map.
* @returns: classic or main map
*/
LevelMap* Board::getMap() {
if(mapType == 0) {
return &classicMap;
} else {
return &campusMap;
}
};
/**
* This switches the map type from the campus map to the classic map.
* @brief: This switches the map type.
*/
void Board::switchMap(int type) {
/*
* type: 0 - classic
* 1 - campus map
*/
switch(type) {
case 0:
setBoardMapType(0);
classicMap = LevelMap();
break;
case 1:
setBoardMapType(1);
campusMap = LevelMap(1);
}
}
/**
* This will set the board type.
* @brief: this will set the map of the board.
*/
void Board::setBoardMapType(int num) {
mapType = num;
}
/**
* This will set the starting building map
* @brief: this will set the starting map
*/
void Board::setStartBuildingMap(std::vector<LevelMap> buildingMap) {
startBuildingMap = buildingMap;
}
/**
* This will set the target building
* @brief: This will set the target building.
*/
void Board::setTargetBuildingMap(std::vector<LevelMap> buildingMap){
targetBuildingMap = buildingMap;
}
/**
* This vector will set the start building and the target building
* @brief: This vector will set the start and the target buildings.
*/
std::vector<std::vector<LevelMap>> Board::getBuildingMap(){
std::vector<std::vector<LevelMap>> vect{ startBuildingMap, targetBuildingMap };
return vect;
}
/**
* This will change the block in the map
* @brief: This will change the block in the map.
*/
void Board::changeBlockInMap(int row, int col, int type) {
if(mapType == 0) {
Block* nodeToChange = classicMap.getNode(row, col);
nodeToChange->setType(type);
}
}