Refactors constants out of Clans.h.

This commit is contained in:
2023-04-25 12:56:51 -07:00
parent 07af18f616
commit d322bd0c5c
5 changed files with 78 additions and 63 deletions

View File

@@ -28,7 +28,7 @@ CharacterType::CharacterType() {
concept = ""; concept = "";
age = ""; age = "";
genderId = 0; genderId = 0;
clanId = 0; clan_id = 0;
natureId = 0; natureId = 0;
demeanorId = 0; demeanorId = 0;
generation = 3; generation = 3;
@@ -754,4 +754,12 @@ int CharacterType::GetGeneration() const {
int GetInitialGeneration() { int GetInitialGeneration() {
return kInitialGeneration; return kInitialGeneration;
} }
int CharacterType::GetClanId() const {
return clan_id;
}
void CharacterType::SetClanId(int value) {
clan_id = value;
}
} // End namespace SBF } // End namespace SBF

View File

@@ -46,6 +46,7 @@ class CharacterType {
std::vector<int> GetAttributeValuesInGroup(int group_id) const; std::vector<int> GetAttributeValuesInGroup(int group_id) const;
int GetBackgroundValue(int id) const; int GetBackgroundValue(int id) const;
std::vector<int> GetBackgroundValues() const; std::vector<int> GetBackgroundValues() const;
int GetClanId() const;
int GetDisciplineValue(int id) const; int GetDisciplineValue(int id) const;
std::vector<int> GetDisciplineValues() const; std::vector<int> GetDisciplineValues() const;
int GetFreebiePoints() const; int GetFreebiePoints() const;
@@ -63,6 +64,7 @@ class CharacterType {
void SetAbilityValue(int group_id, int id, int value); void SetAbilityValue(int group_id, int id, int value);
void SetAttributeValue(int group_id, int id, int value); void SetAttributeValue(int group_id, int id, int value);
void SetBackgroundValue(int id, int value); void SetBackgroundValue(int id, int value);
void SetClanId(int value);
void SetDisciplineValue(int id, int value); void SetDisciplineValue(int id, int value);
void SetFreebiePoints(int value); void SetFreebiePoints(int value);
void SetGeneration(int value); void SetGeneration(int value);
@@ -83,7 +85,6 @@ class CharacterType {
std::string concept; std::string concept;
std::string age; std::string age;
int genderId; int genderId;
int clanId;
int natureId; int natureId;
int demeanorId; int demeanorId;
int conscience; int conscience;
@@ -95,6 +96,7 @@ class CharacterType {
private: private:
// Scalars // Scalars
int clan_id;
int freebie_points; int freebie_points;
int generation; int generation;
std::string road_name; std::string road_name;

View File

@@ -37,7 +37,7 @@ void CGGetHeader(CharacterType& ch) {
ch.genderId = ChooseStringId(genders, ms, "What is the character's gender?"); ch.genderId = ChooseStringId(genders, ms, "What is the character's gender?");
vector<string> clans; vector<string> clans;
FillClanLabels(clans); FillClanLabels(clans);
ch.clanId = ChooseStringId(clans, ms, "What clan is the character from?"); ch.SetClanId(ChooseStringId(clans, ms, "What clan is the character from?"));
vector<string> archetypes; vector<string> archetypes;
FillArchetypeLabels(archetypes); FillArchetypeLabels(archetypes);
ch.natureId = ChooseStringId(archetypes, ms, "What is the character's nature?"); ch.natureId = ChooseStringId(archetypes, ms, "What is the character's nature?");
@@ -150,7 +150,7 @@ void CGSpendVirtuePoints(CharacterType& ch) {
} }
void CGGetDerangement(CharacterType& ch) { void CGGetDerangement(CharacterType& ch) {
if (ch.clanId == kClanMalkavian) { if (ch.GetClanId() == kClanMalkavianId) {
// If the clan is malkavian then pick a derangement. // If the clan is malkavian then pick a derangement.
MenuStyle ms; MenuStyle ms;
ms.use_colors = true; ms.use_colors = true;
@@ -381,7 +381,8 @@ void ShowCharacterSheet(CharacterType& ch) {
cout << "╔══════════════════════════════════════╦═══════════════════════════════════════╗" << endl; cout << "╔══════════════════════════════════════╦═══════════════════════════════════════╗" << endl;
cout << "║ Name: " << MakeFitL(ch.name, 30) << " ║ Gender: " << MakeFitL(GetGenderLabel(ch.genderId), 14) cout << "║ Name: " << MakeFitL(ch.name, 30) << " ║ Gender: " << MakeFitL(GetGenderLabel(ch.genderId), 14)
<< " Generation: " << MakeFitR(to_string(ch.GetGeneration()), 2) << "" << endl; << " Generation: " << MakeFitR(to_string(ch.GetGeneration()), 2) << "" << endl;
cout << "║ Clan: " << MakeFitL(GetClanLabel(ch.clanId), 30) << " ║ Age: " << MakeFitL(ch.age, 32) << "" << endl; cout << "║ Clan: " << MakeFitL(GetClanLabel(ch.GetClanId()), 30) << " ║ Age: " << MakeFitL(ch.age, 32) << ""
<< endl;
cout << "╠══════════════════════════════════════╣ Player: " << MakeFitL(ch.player, 29) << "" << endl; cout << "╠══════════════════════════════════════╣ Player: " << MakeFitL(ch.player, 29) << "" << endl;
cout << "║ Attributes ║ Chronicle: " << MakeFitL(ch.chronicle, 26) << "" << endl; cout << "║ Attributes ║ Chronicle: " << MakeFitL(ch.chronicle, 26) << "" << endl;
cout << "" << MakeFitC("Physical", 12) << MakeFitC("Social", 12) << MakeFitC("Mental", 12) cout << "" << MakeFitC("Physical", 12) << MakeFitC("Social", 12) << MakeFitC("Mental", 12)

View File

@@ -4,6 +4,50 @@
#include <vector> #include <vector>
namespace SBF { namespace SBF {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-const-variable"
const std::string kClanAnarchLabel = "Anarch";
const std::string kClanAssamiteLabel = "Assamite";
const std::string kClanBaaliLabel = "Baali";
const std::string kClanBrujahLabel = "Brujah";
const std::string kClanCaitiffLabel = "Caitiff";
const std::string kClanCappadocianLabel = "Cappadocian";
const std::string kClanGangrelLabel = "Gangrel";
const std::string kClanGiovanniLabel = "Giovanni";
const std::string kClanInconnuLabel = "Inconnu";
const std::string kClanLasombraLabel = "Lasombra";
const std::string kClanMalkavianLabel = "Malkavian";
const std::string kClanNosferatuLabel = "Nosferatu";
const std::string kClanRavanosLabel = "Ravanos";
const std::string kClanSettiteLabel = "Settite";
const std::string kClanToreadorLabel = "Toreador";
const std::string kClanTremereLabel = "Tremere";
const std::string kClanTzismiceLabel = "Tzismice";
const std::string kClanVentrueLabel = "Ventrue";
const int kClansCount = 18;
const std::string kClanLabels[] = {
"",
kClanAnarchLabel,
kClanAssamiteLabel,
kClanBaaliLabel,
kClanBrujahLabel,
kClanCaitiffLabel,
kClanCappadocianLabel,
kClanGangrelLabel,
kClanGiovanniLabel,
kClanInconnuLabel,
kClanLasombraLabel,
kClanMalkavianLabel,
kClanNosferatuLabel,
kClanRavanosLabel,
kClanSettiteLabel,
kClanToreadorLabel,
kClanTremereLabel,
kClanTzismiceLabel,
kClanVentrueLabel,
};
#pragma clang diagnostic pop
std::string GetClanLabel(int clan_id) { std::string GetClanLabel(int clan_id) {
if (clan_id > 0 && clan_id <= kClansCount) { if (clan_id > 0 && clan_id <= kClansCount) {
return kClanLabels[clan_id]; return kClanLabels[clan_id];

View File

@@ -15,64 +15,24 @@
* @{ * @{
*/ */
namespace SBF { namespace SBF {
const int kClanAnarch = 1; const int kClanAnarchId = 1;
const std::string kClanAnarchLabel = "Anarch"; const int kClanAssamiteId = 2;
const int kClanAssamite = 2; const int kClanBaaliId = 3;
const std::string kClanAssamiteLabel = "Assamite"; const int kClanBrujahId = 4;
const int kClanBaali = 3; const int kClanCaitiffId = 5;
const std::string kClanBaaliLabel = "Baali"; const int kClanCappadocianId = 6;
const int kClanBrujah = 4; const int kClanGangrelId = 7;
const std::string kClanBrujahLabel = "Brujah"; const int kClanGiovanniId = 8;
const int kClanCaitiff = 5; const int kClanInconnuId = 9;
const std::string kClanCaitiffLabel = "Caitiff"; const int kClanLasombraId = 10;
const int kClanCappadocian = 6; const int kClanMalkavianId = 11;
const std::string kClanCappadocianLabel = "Cappadocian"; const int kClanNosferatuId = 12;
const int kClanGangrel = 7; const int kClanRavanosId = 13;
const std::string kClanGangrelLabel = "Gangrel"; const int kClanSettiteId = 14;
const int kClanGiovanni = 8; const int kClanToreadorId = 15;
const std::string kClanGiovanniLabel = "Giovanni"; const int kClanTremereId = 16;
const int kClanInconnu = 9; const int kClanTzismiceId = 17;
const std::string kClanInconnuLabel = "Inconnu"; const int kClanVentrueId = 18;
const int kClanLasombra = 10;
const std::string kClanLasombraLabel = "Lasombra";
const int kClanMalkavian = 11;
const std::string kClanMalkavianLabel = "Malkavian";
const int kClanNosferatu = 12;
const std::string kClanNosferatuLabel = "Nosferatu";
const int kClanRavanos = 13;
const std::string kClanRavanosLabel = "Ravanos";
const int kClanSettite = 14;
const std::string kClanSettiteLabel = "Settite";
const int kClanToreador = 15;
const std::string kClanToreadorLabel = "Toreador";
const int kClanTremere = 16;
const std::string kClanTremereLabel = "Tremere";
const int kClanTzismice = 17;
const std::string kClanTzismiceLabel = "Tzismice";
const int kClanVentrue = 18;
const std::string kClanVentrueLabel = "Ventrue";
const int kClansCount = 18;
const std::string kClanLabels[] = {
"",
kClanAnarchLabel,
kClanAssamiteLabel,
kClanBaaliLabel,
kClanBrujahLabel,
kClanCaitiffLabel,
kClanCappadocianLabel,
kClanGangrelLabel,
kClanGiovanniLabel,
kClanInconnuLabel,
kClanLasombraLabel,
kClanMalkavianLabel,
kClanNosferatuLabel,
kClanRavanosLabel,
kClanSettiteLabel,
kClanToreadorLabel,
kClanTremereLabel,
kClanTzismiceLabel,
kClanVentrueLabel,
};
/// @brief Gets the label for a clan with a specific id. /// @brief Gets the label for a clan with a specific id.
/// @param clan_id The id of the clan to get the label for. /// @param clan_id The id of the clan to get the label for.