Refactors constants out of Virtues.h.
This commit is contained in:
@@ -257,7 +257,7 @@ int CharacterType::GetVirtueValue(int id) const {
|
|||||||
|
|
||||||
void CharacterType::FillVirtueValues(std::vector<int>& values) const {
|
void CharacterType::FillVirtueValues(std::vector<int>& values) const {
|
||||||
values.clear();
|
values.clear();
|
||||||
for (int id = 0; id <= kVirtuesCount; id++) {
|
for (int id = 0; id <= GetNumVirtues(); id++) {
|
||||||
values.push_back(GetVirtueValue(id));
|
values.push_back(GetVirtueValue(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ void CGSpendAbilityPoint(CharacterType& ch) {
|
|||||||
void CGSpendVirtuePoint(CharacterType& ch) {
|
void CGSpendVirtuePoint(CharacterType& ch) {
|
||||||
MenuStyle ms;
|
MenuStyle ms;
|
||||||
ms.show_cancel = true;
|
ms.show_cancel = true;
|
||||||
ms.cancel_item_id = kVirtuesCount + 1;
|
ms.cancel_item_id = GetNumVirtues() + 1;
|
||||||
string prompt = "What virtue would you like to add 1 dot to?";
|
string prompt = "What virtue would you like to add 1 dot to?";
|
||||||
int id = ChooseStringIdWithValues(GetVirtueLabels(), ch.GetVirtueValues(), ms, prompt);
|
int id = ChooseStringIdWithValues(GetVirtueLabels(), ch.GetVirtueValues(), ms, prompt);
|
||||||
if (id != ms.cancel_item_id) {
|
if (id != ms.cancel_item_id) {
|
||||||
|
|||||||
@@ -9,6 +9,18 @@ using std::string;
|
|||||||
using std::vector;
|
using std::vector;
|
||||||
} // End namespace
|
} // End namespace
|
||||||
|
|
||||||
|
const std::string kVirtueUnknownLabel = "";
|
||||||
|
const std::string kVirtueSelfControlLabel = "Self-Control";
|
||||||
|
const std::string kVirtueCourageLabel = "Courage";
|
||||||
|
const std::string kVirtueConscienceLabel = "Conscience";
|
||||||
|
const int kVirtuesCount = 3;
|
||||||
|
const std::string kVirtueLabels[] = {
|
||||||
|
kVirtueUnknownLabel,
|
||||||
|
kVirtueSelfControlLabel,
|
||||||
|
kVirtueCourageLabel,
|
||||||
|
kVirtueConscienceLabel,
|
||||||
|
};
|
||||||
|
|
||||||
const string GetVirtueLabel(int id) {
|
const string GetVirtueLabel(int id) {
|
||||||
if (id > 0 && id <= kVirtuesCount) {
|
if (id > 0 && id <= kVirtuesCount) {
|
||||||
return kVirtueLabels[id];
|
return kVirtueLabels[id];
|
||||||
@@ -28,4 +40,8 @@ vector<string> GetVirtueLabels() {
|
|||||||
FillVirtueLabels(labels);
|
FillVirtueLabels(labels);
|
||||||
return labels;
|
return labels;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int GetNumVirtues() {
|
||||||
|
return kVirtuesCount;
|
||||||
|
}
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|||||||
@@ -16,20 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
namespace SBF {
|
namespace SBF {
|
||||||
const int kVirtuePoints = 7;
|
const int kVirtuePoints = 7;
|
||||||
const std::string kVirtueUnknownLabel = "";
|
|
||||||
const int kVirtueSelfControlId = 1;
|
const int kVirtueSelfControlId = 1;
|
||||||
const std::string kVirtueSelfControlLabel = "Self-Control";
|
|
||||||
const int kVirtueCourageId = 2;
|
const int kVirtueCourageId = 2;
|
||||||
const std::string kVirtueCourageLabel = "Courage";
|
|
||||||
const int kVirtueConscienceId = 3;
|
const int kVirtueConscienceId = 3;
|
||||||
const std::string kVirtueConscienceLabel = "Conscience";
|
|
||||||
const int kVirtuesCount = 3;
|
|
||||||
const std::string kVirtueLabels[] = {
|
|
||||||
kVirtueUnknownLabel,
|
|
||||||
kVirtueSelfControlLabel,
|
|
||||||
kVirtueCourageLabel,
|
|
||||||
kVirtueConscienceLabel,
|
|
||||||
};
|
|
||||||
|
|
||||||
/// @brief Gets the label for virtue with the specified id.
|
/// @brief Gets the label for virtue with the specified id.
|
||||||
/// @param virtue_id The id of the virtue to find.
|
/// @param virtue_id The id of the virtue to find.
|
||||||
@@ -41,6 +30,7 @@ const std::string GetVirtueLabel(int virtue_id);
|
|||||||
void FillVirtueLabels(std::vector<std::string>& virtue_labels);
|
void FillVirtueLabels(std::vector<std::string>& virtue_labels);
|
||||||
|
|
||||||
std::vector<std::string> GetVirtueLabels();
|
std::vector<std::string> GetVirtueLabels();
|
||||||
|
int GetNumVirtues();
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
|
|||||||
@@ -13,6 +13,17 @@ using namespace Test;
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
} // End namespace
|
} // End namespace
|
||||||
|
|
||||||
|
const std::string kVirtueUnknownLabel = "";
|
||||||
|
const std::string kVirtueSelfControlLabel = "Self-Control";
|
||||||
|
const std::string kVirtueCourageLabel = "Courage";
|
||||||
|
const std::string kVirtueConscienceLabel = "Conscience";
|
||||||
|
const std::string kVirtueLabels[] = {
|
||||||
|
kVirtueUnknownLabel,
|
||||||
|
kVirtueSelfControlLabel,
|
||||||
|
kVirtueCourageLabel,
|
||||||
|
kVirtueConscienceLabel,
|
||||||
|
};
|
||||||
|
|
||||||
TestResults test_GetVirtueLabel() {
|
TestResults test_GetVirtueLabel() {
|
||||||
return execute_suite<string, int>(make_test_suite(
|
return execute_suite<string, int>(make_test_suite(
|
||||||
"SBF::GetVirtueLabel",
|
"SBF::GetVirtueLabel",
|
||||||
|
|||||||
Reference in New Issue
Block a user