From 279c5d08932b3a81b3917b14b6f4f2b14b0ae210 Mon Sep 17 00:00:00 2001 From: Tom Hicks Date: Tue, 25 Apr 2023 12:46:39 -0700 Subject: [PATCH] Refactors constants out of Backgrounds.h. --- sbf-cpp/Backgrounds.cpp | 24 ++++++++++++++++++++++++ sbf-cpp/Backgrounds.h | 24 ------------------------ sbf-cpp/Character.cpp | 2 ++ 3 files changed, 26 insertions(+), 24 deletions(-) diff --git a/sbf-cpp/Backgrounds.cpp b/sbf-cpp/Backgrounds.cpp index df39226..c0cf5f1 100644 --- a/sbf-cpp/Backgrounds.cpp +++ b/sbf-cpp/Backgrounds.cpp @@ -9,6 +9,30 @@ using std::string; using std::vector; } // End namespace +const std::string kBackgroundAlliesLabel = "Allies"; +const std::string kBackgroundContactsLabel = "Contacts"; +const std::string kBackgroundFameLabel = "Fame"; +const std::string kBackgroundGenerationLabel = "Generation"; +const std::string kBackgroundHerdLabel = "Herd"; +const std::string kBackgroundInfluenceLabel = "Influence"; +const std::string kBackgroundMentorLabel = "Mentor"; +const std::string kBackgroundResourcesLabel = "Resources"; +const std::string kBackgroundRetainersLabel = "Retainers"; +const std::string kBackgroundStatusLabel = "Status"; +const std::string kBackgroundLabels[] = { + "", + kBackgroundAlliesLabel, + kBackgroundContactsLabel, + kBackgroundFameLabel, + kBackgroundGenerationLabel, + kBackgroundHerdLabel, + kBackgroundInfluenceLabel, + kBackgroundMentorLabel, + kBackgroundResourcesLabel, + kBackgroundRetainersLabel, + kBackgroundStatusLabel, +}; + string GetBackgroundLabel(int backgroundId) { if (backgroundId > 0 && backgroundId <= kBackgroundsCount) { return kBackgroundLabels[backgroundId]; diff --git a/sbf-cpp/Backgrounds.h b/sbf-cpp/Backgrounds.h index 72d1118..a90c526 100644 --- a/sbf-cpp/Backgrounds.h +++ b/sbf-cpp/Backgrounds.h @@ -15,41 +15,17 @@ * @{ */ namespace SBF { -const int kBackgroundPoints = 5; const int kBackgroundAlliesId = 1; -const std::string kBackgroundAlliesLabel = "Allies"; const int kBackgroundContactsId = 2; -const std::string kBackgroundContactsLabel = "Contacts"; const int kBackgroundFameId = 3; -const std::string kBackgroundFameLabel = "Fame"; const int kBackgroundGenerationId = 4; -const std::string kBackgroundGenerationLabel = "Generation"; const int kBackgroundHerdId = 5; -const std::string kBackgroundHerdLabel = "Herd"; const int kBackgroundInfluenceId = 6; -const std::string kBackgroundInfluenceLabel = "Influence"; const int kBackgroundMentorId = 7; -const std::string kBackgroundMentorLabel = "Mentor"; const int kBackgroundResourcesId = 8; -const std::string kBackgroundResourcesLabel = "Resources"; const int kBackgroundRetainersId = 9; -const std::string kBackgroundRetainersLabel = "Retainers"; const int kBackgroundStatusId = 10; -const std::string kBackgroundStatusLabel = "Status"; const int kBackgroundsCount = 10; -const std::string kBackgroundLabels[] = { - "", - kBackgroundAlliesLabel, - kBackgroundContactsLabel, - kBackgroundFameLabel, - kBackgroundGenerationLabel, - kBackgroundHerdLabel, - kBackgroundInfluenceLabel, - kBackgroundMentorLabel, - kBackgroundResourcesLabel, - kBackgroundRetainersLabel, - kBackgroundStatusLabel, -}; /// @brief Gets the label for a background with a specific id. /// @param background_id The id of the background to get the label for. diff --git a/sbf-cpp/Character.cpp b/sbf-cpp/Character.cpp index ba2763e..ea307fb 100644 --- a/sbf-cpp/Character.cpp +++ b/sbf-cpp/Character.cpp @@ -16,6 +16,8 @@ using std::string; using std::vector; } // namespace +const int kBackgroundPoints = 5; + CharacterType::CharacterType() { // Scalars name = "";