Refactors constants out of Freebies.h.

This commit is contained in:
2023-04-25 13:38:54 -07:00
parent c3cd1e65ff
commit f35c0f21d0
4 changed files with 130 additions and 102 deletions

View File

@@ -8,6 +8,86 @@ using std::ostream;
using std::vector;
} // End namespace
const int kFreebieDisciplineCost = 7;
const std::string kFreebieDisciplineName = "Discipline";
const std::string kFreebieDisciplineLabel = "Add a discipline dot 7 points";
const FreebieType kFreebieDiscipline = {
kFreebieDisciplineId, kFreebieDisciplineCost, kFreebieDisciplineName, kFreebieDisciplineLabel};
const int kFreebieAttributeCost = 5;
const std::string kFreebieAttributeName = "Attribute";
const std::string kFreebieAttributeLabel = "Add an attribute dot 5 points";
const FreebieType kFreebieAttribute = {
kFreebieAttributeId, kFreebieAttributeCost, kFreebieAttributeName, kFreebieAttributeLabel};
const int kFreebieAbilityCost = 2;
const std::string kFreebieAbilityName = "Ability";
const std::string kFreebieAbilityLabel = "Add an ability dot 2 points";
const FreebieType kFreebieAbility = {kFreebieAbilityId, kFreebieAbilityCost, kFreebieAbilityName, kFreebieAbilityLabel};
const int kFreebieVirtueCost = 2;
const std::string kFreebieVirtueName = "Virtue";
const std::string kFreebieVirtueLabel = "Add a virtue dot 2 points";
const FreebieType kFreebieVirtue = {kFreebieVirtueId, kFreebieVirtueCost, kFreebieVirtueName, kFreebieVirtueLabel};
const int kFreebieHumanityCost = 1;
const std::string kFreebieHumanityName = "Humanity";
const std::string kFreebieHumanityLabel = "Add a humanity dot 1 point";
const FreebieType kFreebieHumanity = {
kFreebieHumanityId, kFreebieHumanityCost, kFreebieHumanityName, kFreebieHumanityLabel};
const int kFreebieBackgroundCost = 1;
const std::string kFreebieBackgroundName = "Background";
const std::string kFreebieBackgroundLabel = "Add a background dot 1 point";
const FreebieType kFreebieBackground = {
kFreebieBackgroundId, kFreebieBackgroundCost, kFreebieBackgroundName, kFreebieBackgroundLabel};
const int kFreebieShowCharacterSheetCost = 0;
const std::string kFreebieShowCharacterSheetName = "Show character sheet";
const std::string kFreebieShowCharacterSheetLabel = "Show character sheet";
const FreebieType kFreebieShowCharacterSheet = {kFreebieShowCharacterSheetId,
kFreebieShowCharacterSheetCost,
kFreebieShowCharacterSheetName,
kFreebieShowCharacterSheetLabel};
const int kFreebieCosts[] = {
0,
kFreebieDisciplineCost,
kFreebieAttributeCost,
kFreebieAbilityCost,
kFreebieVirtueCost,
kFreebieHumanityCost,
kFreebieBackgroundCost,
kFreebieShowCharacterSheetCost,
};
const std::string kFreebieNames[] = {
"",
kFreebieDisciplineName,
kFreebieAttributeName,
kFreebieAbilityName,
kFreebieVirtueName,
kFreebieHumanityName,
kFreebieBackgroundName,
kFreebieShowCharacterSheetName,
};
const std::string kFreebieLabels[] = {
"",
kFreebieDisciplineLabel,
kFreebieAttributeLabel,
kFreebieAbilityLabel,
kFreebieVirtueLabel,
kFreebieHumanityLabel,
kFreebieBackgroundLabel,
kFreebieShowCharacterSheetLabel,
};
const FreebieType kFreebies[] = {
kFreebieUnknown,
kFreebieDiscipline,
kFreebieAttribute,
kFreebieAbility,
kFreebieVirtue,
kFreebieHumanity,
kFreebieBackground,
kFreebieShowCharacterSheet,
};
ostream& operator<<(ostream& os, const FreebieType& freebie) {
os << "Freebie: {id: " << freebie.id << ", cost: " << freebie.cost << ", name: \"" << freebie.name << "\", label: \""
<< freebie.label << "\"}";
@@ -56,4 +136,11 @@ vector<FreebieType> GetAvailableFreebies(int freebie_points) {
return freebies;
}
int GetFreebieCost(int id) {
if (id > 0 && id <= kFreebiesCount) {
return kFreebieCosts[id];
}
return 0;
}
} // End namespace SBF