Refactors constants out of Attributes.h.

This commit is contained in:
2023-04-25 12:44:21 -07:00
parent d1314e16a4
commit 34678d9af6
4 changed files with 128 additions and 117 deletions

View File

@@ -10,6 +10,78 @@ using std::string;
using std::vector;
} // End namespace
const int kPhysicalAttributesCount = 3;
const int kSocialAttributesCount = 3;
const int kMentalAttributesCount = 3;
const int kAttributeGroupsCount = 3;
const std::string kPhysicalAttributeStrengthLabel = "Strength";
const std::string kPhysicalAttributeStrengthAbbreviation = "Str.";
const std::string kPhysicalAttributeDexterityLabel = "Dexterity";
const std::string kPhysicalAttributeDexterityAbbreviation = "Dex.";
const std::string kPhysicalAttributeStaminaLabel = "Stamina";
const std::string kPhysicalAttributeStaminaAbbreviation = "Sta.";
const std::string kPhysicalAttributeLabels[] = {
"",
kPhysicalAttributeStrengthLabel,
kPhysicalAttributeDexterityLabel,
kPhysicalAttributeStaminaLabel,
};
const std::string kPhysicalAttributeLabelAbbreviations[] = {
"",
kPhysicalAttributeStrengthAbbreviation,
kPhysicalAttributeDexterityAbbreviation,
kPhysicalAttributeStaminaAbbreviation,
};
const std::string kSocialAttributeCharismaLabel = "Charisma";
const std::string kSocialAttributeCharismaAbbreviation = "Cha.";
const std::string kSocialAttributeManipulationLabel = "Manipulation";
const std::string kSocialAttributeManipulationAbbreviation = "Man.";
const std::string kSocialAttributeAppearanceLabel = "Appearance";
const std::string kSocialAttributeAppearanceAbbreviation = "App.";
const std::string kSocialAttributeLabels[] = {
"",
kSocialAttributeCharismaLabel,
kSocialAttributeManipulationLabel,
kSocialAttributeAppearanceLabel,
};
const std::string kSocialAttributeLabelAbbreviations[] = {
"",
kSocialAttributeCharismaAbbreviation,
kSocialAttributeManipulationAbbreviation,
kSocialAttributeAppearanceAbbreviation,
};
const std::string kMentalAttributeIntelligenceLabel = "Intelligence";
const std::string kMentalAttributeIntelligenceAbbreviation = "Int.";
const std::string kMentalAttributePerceptionLabel = "Perception";
const std::string kMentalAttributePerceptionAbbreviation = "Per.";
const std::string kMentalAttributeWitsLabel = "Wits";
const std::string kMentalAttributeWitsAbbreviation = "Wits";
const std::string kMentalAttributeLabels[] = {
"",
kMentalAttributeIntelligenceLabel,
kMentalAttributePerceptionLabel,
kMentalAttributeWitsLabel,
};
const std::string kMentalAttributeLabelAbbreviations[] = {
"",
kMentalAttributeIntelligenceAbbreviation,
kMentalAttributePerceptionAbbreviation,
kMentalAttributeWitsAbbreviation,
};
const std::string kAttributeGroupPhysicalLabel = "Physical";
const std::string kAttributeGroupSocialLabel = "Social";
const std::string kAttributeGroupMentalLabel = "Mental";
const std::string kAttributeGroups[] = {
"",
kAttributeGroupPhysicalLabel,
kAttributeGroupSocialLabel,
kAttributeGroupMentalLabel,
};
string GetAttributeGroupLabel(int attributeGroupId) {
if (attributeGroupId > 0 && attributeGroupId <= kAttributeGroupsCount) {
return kAttributeGroups[attributeGroupId];
@@ -156,4 +228,50 @@ void FillMentalAttributeLabels(std::vector<std::string>& labels) {
}
}
void FillAttributeLabelsInGroup(std::vector<string> labels, int group_id) {
labels.clear();
switch (group_id) {
case kAttributeGroupPhysicalId:
for (int id = 0; id <= kPhysicalAttributesCount; id++) {
labels.push_back(kPhysicalAttributeLabels[id]);
}
break;
case kAttributeGroupSocialId:
for (int id = 0; id <= kSocialAttributesCount; id++) {
labels.push_back(kSocialAttributeLabels[id]);
}
break;
case kAttributeGroupMentalId:
for (int id = 0; id <= kMentalAttributesCount; id++) {
labels.push_back(kMentalAttributeLabels[id]);
}
break;
}
}
void FillAttributeAbbreviationsInGroup(std::vector<string> abbreviations, int group_id) {
abbreviations.clear();
switch (group_id) {
case kAttributeGroupPhysicalId:
for (int id = 0; id <= kPhysicalAttributesCount; id++) {
abbreviations.push_back(kPhysicalAttributeLabelAbbreviations[id]);
}
break;
case kAttributeGroupSocialId:
for (int id = 0; id <= kSocialAttributesCount; id++) {
abbreviations.push_back(kSocialAttributeLabelAbbreviations[id]);
}
break;
case kAttributeGroupMentalId:
for (int id = 0; id <= kMentalAttributesCount; id++) {
abbreviations.push_back(kMentalAttributeLabelAbbreviations[id]);
}
break;
}
}
int GetNumAttributeGroups() {
return kAttributeGroupsCount;
}
} // End namespace SBF