Repository navigation
Expand file tree
/
Copy pathAdvantages.cpp
More file actions
116 lines (80 loc) · 2.47 KB
/
Copy pathAdvantages.cpp
File metadata and controls
116 lines (80 loc) · 2.47 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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/**
* @file Advantages.cpp
*
* @brief File containing source code of the Advantages class
*
*
* @author Hugo MARTIN
* Contact: hugo.martin.1@etu.univ-amu.fr
*
*/
#include "classes.h"
/** Constructor of the class Advantages.
*
* Modification of the constructor of Advantages
* Initialisation of a Parsetext reference
* before the Advantages constructor be initialised
*
* @param textParse: reference of Parsetext
*/
vampireGameproject::Advantages::Advantages(Parsetext& textParse): textParser(textParse){}
/** Destructor of the class Advantages.
*
* Modification of the destructor of Advantages
*
*
*
*/
vampireGameproject::Advantages::~Advantages(){}
/** Implementation of the getAdvantages method.
*
* Implementation of the getAdvantages method
* Method returning the Advantages
*
* @param tableName: name of the map category to return the associated map
*
*/
std::map<std::string, int> vampireGameproject::Advantages::getAdvantages(std::string tableName){
if(tableName == "backgrounds"){
return backgrounds;
}
else if(tableName == "virtues"){
return virtues;
}
else{
std::cout << "ERROR, the tableName is false" << std::endl;
return std::map<std::string, int>();
}
}
/** Implementation of the setAdvantages method.
*
* Implementation of the setAdvantages method
* Method setting the advantages
*
* @param tableName: name of the table where setting the advantage
* @param abilitieName: name of the advantage to set
* @param value: value of the advantage to set
*/
void vampireGameproject::Advantages::setAdvantages(std::string tableName, std::string abilitieName, int value){
if(tableName == "backgrounds"){
backgrounds.insert(std::pair<std::string, int>(abilitieName, value));
}
else if(tableName == "virtues"){
virtues.insert(std::pair<std::string, int>(abilitieName, value));
}
else{
std::cout << "ERROR, the tableName is false" << std::endl;
}
}
/** Implementation of the getDescriptionadvantages method.
*
* Implementation of the getDescriptionadvantages method
* getDescriptionadvantages method allows to return the description of
* an advantage
*
* @param table: name of the table to look for an advantage
* @param attributeName: name of the advantage to return the description
*/
std::string vampireGameproject::Advantages::getDescriptionadvantages(std::string table, std::string attributeName){
return textParser.parseText(table, attributeName);
}