Refactors most constants out of Abilities.h.
This commit is contained in:
@@ -8,6 +8,111 @@ using std::ostream;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
const int kAbilitiesCount = 3;
|
||||
|
||||
const std::string kAbilityUnknownLabel = "";
|
||||
const std::string kAbilityTalentsSingular = "Talent";
|
||||
const std::string kAbilityTalentsPlural = "Talents";
|
||||
const std::string kAbilitySkillsSingular = "Skill";
|
||||
const std::string kAbilitySkillsPlural = "Skills";
|
||||
const std::string kAbilityKnowledgesSingular = "Knowledge";
|
||||
const std::string kAbilityKnowledgesPlural = "Knowledges";
|
||||
const AbilityType kAbilityGroupUnknown = {0, "", ""};
|
||||
const AbilityType kAbilityGroupTalents = {
|
||||
kAbilityTalentsId,
|
||||
kAbilityTalentsSingular,
|
||||
kAbilityTalentsPlural,
|
||||
};
|
||||
const AbilityType kAbilityGroupSkills = {
|
||||
kAbilitySkillsId,
|
||||
kAbilitySkillsSingular,
|
||||
kAbilitySkillsPlural,
|
||||
};
|
||||
const AbilityType kAbilityGroupKnowledges = {
|
||||
kAbilityKnowledgesId,
|
||||
kAbilityKnowledgesSingular,
|
||||
kAbilityKnowledgesPlural,
|
||||
};
|
||||
const AbilityType kAbilities[]{
|
||||
kAbilityGroupUnknown,
|
||||
kAbilityGroupTalents,
|
||||
kAbilityGroupSkills,
|
||||
kAbilityGroupKnowledges,
|
||||
};
|
||||
|
||||
const std::string kTalentActingLabel = "Acting";
|
||||
const std::string kTalentAlertnessLabel = "Alertness";
|
||||
const std::string kTalentAthleticsLabel = "Athletics";
|
||||
const std::string kTalentBrawlLabel = "Brawl";
|
||||
const std::string kTalentDodgeLabel = "Dodge";
|
||||
const std::string kTalentEmpathyLabel = "Empathy";
|
||||
const std::string kTalentIntimidationLabel = "Intimidation";
|
||||
const std::string kTalentLeadershipLabel = "Leadership";
|
||||
const std::string kTalentStreetwiseLabel = "Streetwise";
|
||||
const std::string kTalentSubterfugeLabel = "Subterfuge";
|
||||
const std::string kSkillAnimalKenLabel = "Animal Ken";
|
||||
const std::string kSkillDriveLabel = "Drive";
|
||||
const std::string kSkillEtiquetteLabel = "Etiquette";
|
||||
const std::string kSkillFirearmsLabel = "Firearms";
|
||||
const std::string kSkillMeleeLabel = "Melee";
|
||||
const std::string kSkillMusicLabel = "Music";
|
||||
const std::string kSkillRepairLabel = "Repair";
|
||||
const std::string kSkillSecurityLabel = "Security";
|
||||
const std::string kSkillStealthLabel = "Stealth";
|
||||
const std::string kSkillSurvivalLabel = "Survival";
|
||||
const std::string kKnowledgeBureaucracyLabel = "Bureaucracy";
|
||||
const std::string kKnowledgeComputerLabel = "Computer";
|
||||
const std::string kKnowledgeFinanceLabel = "Finance";
|
||||
const std::string kKnowledgeInvestigationLabel = "Investigation";
|
||||
const std::string kKnowledgeLawLabel = "Law";
|
||||
const std::string kKnowledgeLinguisticsLabel = "Linguistics";
|
||||
const std::string kKnowledgeMedicineLabel = "Medicine";
|
||||
const std::string kKnowledgeOccultLabel = "Occult";
|
||||
const std::string kKnowledgePoliticsLabel = "Politics";
|
||||
const std::string kKnowledgeScienceLabel = "Science";
|
||||
const int kTalentsCount = 10;
|
||||
const int kSkillsCount = 10;
|
||||
const int kKnowledgesCount = 10;
|
||||
const std::string kSkills[] = {
|
||||
kAbilityUnknownLabel,
|
||||
kSkillAnimalKenLabel,
|
||||
kSkillDriveLabel,
|
||||
kSkillEtiquetteLabel,
|
||||
kSkillFirearmsLabel,
|
||||
kSkillMeleeLabel,
|
||||
kSkillMusicLabel,
|
||||
kSkillRepairLabel,
|
||||
kSkillSecurityLabel,
|
||||
kSkillStealthLabel,
|
||||
kSkillSurvivalLabel,
|
||||
};
|
||||
const std::string kTalents[] = {
|
||||
kAbilityUnknownLabel,
|
||||
kTalentActingLabel,
|
||||
kTalentAlertnessLabel,
|
||||
kTalentAthleticsLabel,
|
||||
kTalentBrawlLabel,
|
||||
kTalentDodgeLabel,
|
||||
kTalentEmpathyLabel,
|
||||
kTalentIntimidationLabel,
|
||||
kTalentLeadershipLabel,
|
||||
kTalentStreetwiseLabel,
|
||||
kTalentSubterfugeLabel,
|
||||
};
|
||||
const std::string kKnowledges[] = {
|
||||
kAbilityUnknownLabel,
|
||||
kKnowledgeBureaucracyLabel,
|
||||
kKnowledgeComputerLabel,
|
||||
kKnowledgeFinanceLabel,
|
||||
kKnowledgeInvestigationLabel,
|
||||
kKnowledgeLawLabel,
|
||||
kKnowledgeLinguisticsLabel,
|
||||
kKnowledgeMedicineLabel,
|
||||
kKnowledgeOccultLabel,
|
||||
kKnowledgePoliticsLabel,
|
||||
kKnowledgeScienceLabel,
|
||||
};
|
||||
|
||||
ostream& operator<<(ostream& os, const AbilityType& ability) {
|
||||
os << "AbilityGroup: {id: " << ability.id << ", singular: \"" << ability.singular << "\", plural: \""
|
||||
<< ability.plural << "\"}";
|
||||
@@ -168,4 +273,7 @@ const std::string GetTalentLabel(int talent_id) {
|
||||
return "";
|
||||
}
|
||||
|
||||
int GetNumAbilityGroups() {
|
||||
return kAbilitiesCount;
|
||||
}
|
||||
} // End namespace SBF
|
||||
|
||||
@@ -17,15 +17,41 @@
|
||||
*/
|
||||
namespace SBF {
|
||||
const int kAbilityTalentsId = 1;
|
||||
const std::string kAbilityTalentsSingular = "Talent";
|
||||
const std::string kAbilityTalentsPlural = "Talents";
|
||||
const int kAbilitySkillsId = 2;
|
||||
const std::string kAbilitySkillsSingular = "Skill";
|
||||
const std::string kAbilitySkillsPlural = "Skills";
|
||||
const int kAbilityKnowledgesId = 3;
|
||||
const std::string kAbilityKnowledgesSingular = "Knowledge";
|
||||
const std::string kAbilityKnowledgesPlural = "Knowledges";
|
||||
const int kAbilitiesCount = 3;
|
||||
|
||||
const int kTalentActingId = 1;
|
||||
const int kTalentAlertnessId = 2;
|
||||
const int kTalentAthleticsId = 3;
|
||||
const int kTalentBrawlId = 4;
|
||||
const int kTalentDodgeId = 5;
|
||||
const int kTalentEmpathyId = 6;
|
||||
const int kTalentIntimidationId = 7;
|
||||
const int kTalentLeadershipId = 8;
|
||||
const int kTalentStreetwiseId = 9;
|
||||
const int kTalentSubterfugeId = 10;
|
||||
|
||||
const int kSkillAnimalKenId = 1;
|
||||
const int kSkillDriveId = 2;
|
||||
const int kSkillEtiquetteId = 3;
|
||||
const int kSkillFirearmsId = 4;
|
||||
const int kSkillMeleeId = 5;
|
||||
const int kSkillMusicId = 6;
|
||||
const int kSkillRepairId = 7;
|
||||
const int kSkillSecurityId = 8;
|
||||
const int kSkillStealthId = 9;
|
||||
const int kSkillSurvivalId = 10;
|
||||
|
||||
const int kKnowledgeBureaucracyId = 1;
|
||||
const int kKnowledgeComputerId = 2;
|
||||
const int kKnowledgeFinanceId = 3;
|
||||
const int kKnowledgeInvestigationId = 4;
|
||||
const int kKnowledgeLawId = 5;
|
||||
const int kKnowledgeLinguisticsId = 6;
|
||||
const int kKnowledgeMedicineId = 7;
|
||||
const int kKnowledgeOccultId = 8;
|
||||
const int kKnowledgePoliticsId = 9;
|
||||
const int kKnowledgeScienceId = 10;
|
||||
|
||||
/// @brief This type represents an ability group such as Talents, Skills or Knowledges.
|
||||
struct AbilityType {
|
||||
@@ -37,136 +63,6 @@ struct AbilityType {
|
||||
std::string plural;
|
||||
};
|
||||
|
||||
const AbilityType kAbilityGroupUnknown = {0, "", ""};
|
||||
const AbilityType kAbilityGroupTalents = {
|
||||
kAbilityTalentsId,
|
||||
kAbilityTalentsSingular,
|
||||
kAbilityTalentsPlural,
|
||||
};
|
||||
const AbilityType kAbilityGroupSkills = {
|
||||
kAbilitySkillsId,
|
||||
kAbilitySkillsSingular,
|
||||
kAbilitySkillsPlural,
|
||||
};
|
||||
const AbilityType kAbilityGroupKnowledges = {
|
||||
kAbilityKnowledgesId,
|
||||
kAbilityKnowledgesSingular,
|
||||
kAbilityKnowledgesPlural,
|
||||
};
|
||||
const AbilityType kAbilities[]{
|
||||
kAbilityGroupUnknown,
|
||||
kAbilityGroupTalents,
|
||||
kAbilityGroupSkills,
|
||||
kAbilityGroupKnowledges,
|
||||
};
|
||||
|
||||
const std::string kAbilityUnknownLabel = "";
|
||||
|
||||
const int kTalentActingId = 1;
|
||||
const std::string kTalentActingLabel = "Acting";
|
||||
const int kTalentAlertnessId = 2;
|
||||
const std::string kTalentAlertnessLabel = "Alertness";
|
||||
const int kTalentAthleticsId = 3;
|
||||
const std::string kTalentAthleticsLabel = "Athletics";
|
||||
const int kTalentBrawlId = 4;
|
||||
const std::string kTalentBrawlLabel = "Brawl";
|
||||
const int kTalentDodgeId = 5;
|
||||
const std::string kTalentDodgeLabel = "Dodge";
|
||||
const int kTalentEmpathyId = 6;
|
||||
const std::string kTalentEmpathyLabel = "Empathy";
|
||||
const int kTalentIntimidationId = 7;
|
||||
const std::string kTalentIntimidationLabel = "Intimidation";
|
||||
const int kTalentLeadershipId = 8;
|
||||
const std::string kTalentLeadershipLabel = "Leadership";
|
||||
const int kTalentStreetwiseId = 9;
|
||||
const std::string kTalentStreetwiseLabel = "Streetwise";
|
||||
const int kTalentSubterfugeId = 10;
|
||||
const std::string kTalentSubterfugeLabel = "Subterfuge";
|
||||
const int kTalentsCount = 10;
|
||||
const std::string kTalents[] = {
|
||||
kAbilityUnknownLabel,
|
||||
kTalentActingLabel,
|
||||
kTalentAlertnessLabel,
|
||||
kTalentAthleticsLabel,
|
||||
kTalentBrawlLabel,
|
||||
kTalentDodgeLabel,
|
||||
kTalentEmpathyLabel,
|
||||
kTalentIntimidationLabel,
|
||||
kTalentLeadershipLabel,
|
||||
kTalentStreetwiseLabel,
|
||||
kTalentSubterfugeLabel,
|
||||
};
|
||||
|
||||
const int kSkillAnimalKenId = 1;
|
||||
const std::string kSkillAnimalKenLabel = "Animal Ken";
|
||||
const int kSkillDriveId = 2;
|
||||
const std::string kSkillDriveLabel = "Drive";
|
||||
const int kSkillEtiquetteId = 3;
|
||||
const std::string kSkillEtiquetteLabel = "Etiquette";
|
||||
const int kSkillFirearmsId = 4;
|
||||
const std::string kSkillFirearmsLabel = "Firearms";
|
||||
const int kSkillMeleeId = 5;
|
||||
const std::string kSkillMeleeLabel = "Melee";
|
||||
const int kSkillMusicId = 6;
|
||||
const std::string kSkillMusicLabel = "Music";
|
||||
const int kSkillRepairId = 7;
|
||||
const std::string kSkillRepairLabel = "Repair";
|
||||
const int kSkillSecurityId = 8;
|
||||
const std::string kSkillSecurityLabel = "Security";
|
||||
const int kSkillStealthId = 9;
|
||||
const std::string kSkillStealthLabel = "Stealth";
|
||||
const int kSkillSurvivalId = 10;
|
||||
const std::string kSkillSurvivalLabel = "Survival";
|
||||
const int kSkillsCount = 10;
|
||||
const std::string kSkills[] = {
|
||||
kAbilityUnknownLabel,
|
||||
kSkillAnimalKenLabel,
|
||||
kSkillDriveLabel,
|
||||
kSkillEtiquetteLabel,
|
||||
kSkillFirearmsLabel,
|
||||
kSkillMeleeLabel,
|
||||
kSkillMusicLabel,
|
||||
kSkillRepairLabel,
|
||||
kSkillSecurityLabel,
|
||||
kSkillStealthLabel,
|
||||
kSkillSurvivalLabel,
|
||||
};
|
||||
|
||||
const int kKnowledgeBureaucracyId = 1;
|
||||
const std::string kKnowledgeBureaucracyLabel = "Bureaucracy";
|
||||
const int kKnowledgeComputerId = 2;
|
||||
const std::string kKnowledgeComputerLabel = "Computer";
|
||||
const int kKnowledgeFinanceId = 3;
|
||||
const std::string kKnowledgeFinanceLabel = "Finance";
|
||||
const int kKnowledgeInvestigationId = 4;
|
||||
const std::string kKnowledgeInvestigationLabel = "Investigation";
|
||||
const int kKnowledgeLawId = 5;
|
||||
const std::string kKnowledgeLawLabel = "Law";
|
||||
const int kKnowledgeLinguisticsId = 6;
|
||||
const std::string kKnowledgeLinguisticsLabel = "Linguistics";
|
||||
const int kKnowledgeMedicineId = 7;
|
||||
const std::string kKnowledgeMedicineLabel = "Medicine";
|
||||
const int kKnowledgeOccultId = 8;
|
||||
const std::string kKnowledgeOccultLabel = "Occult";
|
||||
const int kKnowledgePoliticsId = 9;
|
||||
const std::string kKnowledgePoliticsLabel = "Politics";
|
||||
const int kKnowledgeScienceId = 10;
|
||||
const std::string kKnowledgeScienceLabel = "Science";
|
||||
const int kKnowledgesCount = 10;
|
||||
const std::string kKnowledges[] = {
|
||||
kAbilityUnknownLabel,
|
||||
kKnowledgeBureaucracyLabel,
|
||||
kKnowledgeComputerLabel,
|
||||
kKnowledgeFinanceLabel,
|
||||
kKnowledgeInvestigationLabel,
|
||||
kKnowledgeLawLabel,
|
||||
kKnowledgeLinguisticsLabel,
|
||||
kKnowledgeMedicineLabel,
|
||||
kKnowledgeOccultLabel,
|
||||
kKnowledgePoliticsLabel,
|
||||
kKnowledgeScienceLabel,
|
||||
};
|
||||
|
||||
/// @brief This function writes an AbilityType value to an output stream;
|
||||
/// @param os The output stream to write to.
|
||||
/// @param group The AbilityType to write.
|
||||
@@ -248,6 +144,8 @@ const std::string GetSkillLabel(int id);
|
||||
/// @param id The id of the ability to return.
|
||||
/// @return The label for the specific ability.
|
||||
const std::string GetTalentLabel(int id);
|
||||
|
||||
int GetNumAbilityGroups();
|
||||
} // End namespace SBF
|
||||
|
||||
/** @}*/
|
||||
|
||||
@@ -22,54 +22,60 @@ TestResults test_AbilityType_operator_extract() {
|
||||
vector<TestTuple<string, AbilityType>>({
|
||||
make_test<string, AbilityType>("should print talents",
|
||||
"AbilityGroup: {id: 1, singular: \"Talent\", plural: \"Talents\"}",
|
||||
make_tuple(kAbilityGroupTalents)),
|
||||
make_tuple(GetAbility(kAbilityTalentsId))),
|
||||
make_test<string, AbilityType>("should print skills",
|
||||
"AbilityGroup: {id: 2, singular: \"Skill\", plural: \"Skills\"}",
|
||||
make_tuple(kAbilityGroupSkills)),
|
||||
make_tuple(GetAbility(kAbilitySkillsId))),
|
||||
make_test<string, AbilityType>("should print knowledges",
|
||||
"AbilityGroup: {id: 3, singular: \"Knowledge\", plural: \"Knowledges\"}",
|
||||
make_tuple(kAbilityGroupKnowledges)),
|
||||
make_tuple(GetAbility(kAbilityKnowledgesId))),
|
||||
make_test<string, AbilityType>("should print an unknown ability group",
|
||||
"AbilityGroup: {id: 0, singular: \"\", plural: \"\"}",
|
||||
make_tuple(kAbilityGroupUnknown)),
|
||||
make_tuple(GetAbility(0))),
|
||||
})));
|
||||
}
|
||||
|
||||
TestResults test_AbilityType_operator_equal_to() {
|
||||
AbilityType skills = GetAbility(kAbilitySkillsId);
|
||||
return execute_suite<bool, AbilityType, AbilityType>(make_test_suite(
|
||||
"SBF::AbilityType::operator==",
|
||||
[](const AbilityType& left, const AbilityType& right) { return left == right; },
|
||||
vector<TestTuple<bool, AbilityType, AbilityType>>({
|
||||
make_test<bool, AbilityType, AbilityType>("should return true when comparing an ability group to itself",
|
||||
make_test<bool, AbilityType, AbilityType>(
|
||||
"should return true when comparing an ability group to itself",
|
||||
true,
|
||||
make_tuple(kAbilityGroupTalents, kAbilityGroupTalents)),
|
||||
make_tuple(GetAbility(kAbilityTalentsId), GetAbility(kAbilityTalentsId))),
|
||||
make_test<bool, AbilityType, AbilityType>(
|
||||
"should return true when comparing two different instances created with the same values",
|
||||
true,
|
||||
make_tuple(kAbilityGroupSkills,
|
||||
AbilityType({kAbilitySkillsId, kAbilitySkillsSingular, kAbilitySkillsPlural}))),
|
||||
make_test<bool, AbilityType, AbilityType>("should return false when comparing two different ability gropus",
|
||||
make_tuple(GetAbility(kAbilitySkillsId),
|
||||
AbilityType({kAbilitySkillsId, skills.singular, skills.plural}))),
|
||||
make_test<bool, AbilityType, AbilityType>(
|
||||
"should return false when comparing two different ability gropus",
|
||||
false,
|
||||
make_tuple(kAbilityGroupKnowledges, kAbilityGroupSkills)),
|
||||
make_tuple(GetAbility(kAbilityKnowledgesId), GetAbility(kAbilitySkillsId))),
|
||||
})));
|
||||
}
|
||||
|
||||
TestResults test_AbilityType_operator_not_equal_to() {
|
||||
AbilityType skills = GetAbility(kAbilitySkillsId);
|
||||
return execute_suite<bool, AbilityType, AbilityType>(make_test_suite(
|
||||
"SBF::AbilityType::operator!=",
|
||||
[](const AbilityType& left, const AbilityType& right) { return left != right; },
|
||||
vector<TestTuple<bool, AbilityType, AbilityType>>({
|
||||
make_test<bool, AbilityType, AbilityType>("should return false when comparing an ability group to itself",
|
||||
make_test<bool, AbilityType, AbilityType>(
|
||||
"should return false when comparing an ability group to itself",
|
||||
false,
|
||||
make_tuple(kAbilityGroupTalents, kAbilityGroupTalents)),
|
||||
make_tuple(GetAbility(kAbilityTalentsId), GetAbility(kAbilityTalentsId))),
|
||||
make_test<bool, AbilityType, AbilityType>(
|
||||
"should return false when comparing two different instances created with the same values",
|
||||
false,
|
||||
make_tuple(kAbilityGroupSkills,
|
||||
AbilityType({kAbilitySkillsId, kAbilitySkillsSingular, kAbilitySkillsPlural}))),
|
||||
make_test<bool, AbilityType, AbilityType>("should return true when comparing two different ability gropus",
|
||||
make_tuple(GetAbility(kAbilitySkillsId),
|
||||
AbilityType({kAbilitySkillsId, skills.singular, skills.plural}))),
|
||||
make_test<bool, AbilityType, AbilityType>(
|
||||
"should return true when comparing two different ability gropus",
|
||||
true,
|
||||
make_tuple(kAbilityGroupKnowledges, kAbilityGroupSkills)),
|
||||
make_tuple(GetAbility(kAbilityKnowledgesId), GetAbility(kAbilitySkillsId))),
|
||||
})));
|
||||
}
|
||||
|
||||
@@ -79,7 +85,8 @@ TestResults test_FillAbilities() {
|
||||
[]() -> string {
|
||||
ostringstream error_message;
|
||||
vector<AbilityType> actual = {{-1, "This should be removed.", "This should be removed."}};
|
||||
vector<AbilityType> expected = {kAbilityGroupTalents, kAbilityGroupSkills, kAbilityGroupKnowledges};
|
||||
vector<AbilityType> expected = {
|
||||
GetAbility(kAbilityTalentsId), GetAbility(kAbilitySkillsId), GetAbility(kAbilityKnowledgesId)};
|
||||
FillAbilities(actual);
|
||||
compare(error_message, expected, actual);
|
||||
string error = error_message.str();
|
||||
@@ -104,7 +111,7 @@ TestResults test_FillAbilitiesForAbilityGroup() {
|
||||
vector<TestTuple<vector<string>, int>>({
|
||||
make_test<vector<string>, int>(
|
||||
"should clear the vector for group 0, kAbilityGropuUnknownId", {}, make_tuple(0)),
|
||||
make_test<vector<string>, int>("should fill talents for group 1 kAbilityGroupTalentsId",
|
||||
make_test<vector<string>, int>("should fill talents for group 1 GetAbility(kAbilityTalentsId)Id",
|
||||
{
|
||||
"Acting",
|
||||
"Alertness",
|
||||
@@ -133,7 +140,7 @@ TestResults test_FillAbilitiesForAbilityGroup() {
|
||||
"Survival",
|
||||
},
|
||||
make_tuple(2)),
|
||||
make_test<vector<string>, int>("should fill knowledges for group 3 kAbilityGroupKnowledgesId",
|
||||
make_test<vector<string>, int>("should fill knowledges for group 3 GetAbility(kAbilityKnowledgesId)Id",
|
||||
{
|
||||
"Bureaucracy",
|
||||
"Computer",
|
||||
@@ -162,7 +169,7 @@ TestResults test_FillAbilityLabels() {
|
||||
vector<TestTuple<vector<string>, int>>({
|
||||
make_test<vector<string>, int>(
|
||||
"should clear the vector for group 0, kAbilityGropuUnknownId", {}, make_tuple(0)),
|
||||
make_test<vector<string>, int>("should fill talents for group 1 kAbilityGroupTalentsId",
|
||||
make_test<vector<string>, int>("should fill talents for group 1 GetAbility(kAbilityTalentsId)Id",
|
||||
{
|
||||
"Acting",
|
||||
"Alertness",
|
||||
@@ -190,7 +197,7 @@ TestResults test_FillAbilityLabels() {
|
||||
"Survival",
|
||||
},
|
||||
make_tuple(2)),
|
||||
make_test<vector<string>, int>("should fill knowledges for group 3 kAbilityGroupKnowledgesId",
|
||||
make_test<vector<string>, int>("should fill knowledges for group 3 GetAbility(kAbilityKnowledgesId)Id",
|
||||
{
|
||||
"Bureaucracy",
|
||||
"Computer",
|
||||
@@ -306,12 +313,13 @@ TestResults test_GetAbility() {
|
||||
"SBF::GetAbility",
|
||||
GetAbility,
|
||||
vector<TestTuple<AbilityType, int>>({
|
||||
make_test<AbilityType, int>("should get talents", kAbilityGroupTalents, make_tuple(kAbilityTalentsId)),
|
||||
make_test<AbilityType, int>("should get skills", kAbilityGroupSkills, make_tuple(kAbilitySkillsId)),
|
||||
make_test<AbilityType, int>(
|
||||
"should get knowledges", kAbilityGroupKnowledges, make_tuple(kAbilityKnowledgesId)),
|
||||
make_test<AbilityType, int>("should get unknown for id 0", kAbilityGroupUnknown, make_tuple(0)),
|
||||
make_test<AbilityType, int>("should get unknown for an invalid id", kAbilityGroupUnknown, make_tuple(4)),
|
||||
"should get talents", GetAbility(kAbilityTalentsId), make_tuple(kAbilityTalentsId)),
|
||||
make_test<AbilityType, int>("should get skills", GetAbility(kAbilitySkillsId), make_tuple(kAbilitySkillsId)),
|
||||
make_test<AbilityType, int>(
|
||||
"should get knowledges", GetAbility(kAbilityKnowledgesId), make_tuple(kAbilityKnowledgesId)),
|
||||
make_test<AbilityType, int>("should get unknown for id 0", GetAbility(0), make_tuple(0)),
|
||||
make_test<AbilityType, int>("should get unknown for an invalid id", GetAbility(0), make_tuple(4)),
|
||||
})));
|
||||
}
|
||||
|
||||
@@ -431,6 +439,14 @@ TestResults test_GetTalentLabel() {
|
||||
})));
|
||||
}
|
||||
|
||||
TestResults test_GetNumAbilityGroups() {
|
||||
return execute_suite<int>(make_test_suite("SBF::Abilities::GetNumAbilityGroups",
|
||||
GetNumAbilityGroups,
|
||||
vector<TestTuple<int>>({
|
||||
make_test<int>("should get 3", 3, make_tuple()),
|
||||
})));
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
TestResults results;
|
||||
|
||||
@@ -446,6 +462,7 @@ int main(int argc, char* argv[]) {
|
||||
results += test_GetAbility();
|
||||
results += test_GetAbilityLabel();
|
||||
results += test_GetKnowledgeLabel();
|
||||
results += test_GetNumAbilityGroups();
|
||||
results += test_GetNumItemsForAbilityGroup();
|
||||
results += test_GetSkillLabel();
|
||||
results += test_GetTalentLabel();
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "Attributes.h"
|
||||
#include "sbf-cpp/Abilities.h"
|
||||
#include "sbf-cpp/Disciplines.h"
|
||||
|
||||
namespace SBF {
|
||||
@@ -42,7 +43,7 @@ CharacterType::CharacterType() {
|
||||
|
||||
// Arrays/Objects
|
||||
// Abilities (Talents/Skills/Knowledges)
|
||||
for (int group_id = 1; group_id <= kAbilitiesCount; group_id++) {
|
||||
for (int group_id = 1; group_id <= GetNumAbilityGroups(); group_id++) {
|
||||
const int num_abilities = GetNumItemsForAbilityGroup(group_id);
|
||||
for (int id = 1; id <= num_abilities; id++) {
|
||||
SetAbilityValue(group_id, id, 0);
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include "Menus.h"
|
||||
#include "Random.h"
|
||||
#include "Utils.h"
|
||||
#include "sbf-cpp/Abilities.h"
|
||||
|
||||
namespace SBF {
|
||||
namespace {
|
||||
@@ -270,7 +271,7 @@ void CGSpendAbilityPoint(CharacterType& ch) {
|
||||
bool done = false;
|
||||
while (!done) {
|
||||
MaybeClearScreen();
|
||||
ms.cancel_item_id = kAbilitiesCount;
|
||||
ms.cancel_item_id = GetNumAbilityGroups();
|
||||
int ability_group_id =
|
||||
ChooseStringId(GetAbilityGroupPluralLabels(), ms, "What kind of ability would you like to add 1 dot to?");
|
||||
if (ability_group_id == ms.cancel_item_id) {
|
||||
|
||||
Reference in New Issue
Block a user