Removes FillDerangements.

Refactors GetAllDerangementsLine to be simpler.
This commit is contained in:
2023-04-24 14:54:45 -07:00
parent 8ec8b1dfe0
commit ec4cf99c60
2 changed files with 9 additions and 15 deletions

View File

@@ -1,11 +1,17 @@
#include "Character.h" #include "Character.h"
#include <sstream>
#include <string>
#include <vector>
#include "Attributes.h" #include "Attributes.h"
namespace SBF { namespace SBF {
namespace {
using std::ostringstream;
using std::string; using std::string;
using std::vector; using std::vector;
} // namespace
CharacterType::CharacterType() { CharacterType::CharacterType() {
// Scalars // Scalars
@@ -711,20 +717,9 @@ void NewDerangement(DerangementType& derangement, int id, string label, int text
} }
string CharacterType::GetAllDerangementsLine() const { string CharacterType::GetAllDerangementsLine() const {
// TODO: Replace this with a stringstream.
std::vector<DerangementType> allDerangements;
FillDerangements(allDerangements);
string allDerangementsString = "";
std::for_each(allDerangements.begin(), allDerangements.end(), [&allDerangementsString](DerangementType derangement) {
allDerangementsString += derangement.label + ", ";
});
return allDerangementsString;
}
void CharacterType::FillDerangements(std::vector<DerangementType> derangements) const {
derangements.clear();
if (derangementId > 0) { if (derangementId > 0) {
derangements[0] = kDerangements[derangementId]; return GetDerangement(derangementId).label;
} }
return "";
} }
} // End namespace SBF } // End namespace SBF

View File

@@ -36,7 +36,6 @@ class CharacterType {
void FillAttributeValues(std::vector<int> attributeValues, int groupId) const; void FillAttributeValues(std::vector<int> attributeValues, int groupId) const;
void FillBackgroundValues(std::vector<int> backgroundValues) const; void FillBackgroundValues(std::vector<int> backgroundValues) const;
void FillDisciplineValues(std::vector<int> disciplineValues) const; void FillDisciplineValues(std::vector<int> disciplineValues) const;
void FillDerangements(std::vector<DerangementType> derangements) const;
void FillVirtueValues(std::vector<int> virtueValues) const; void FillVirtueValues(std::vector<int> virtueValues) const;
int GetAbilityValue(int abilityGroupId, int abilityId) const; int GetAbilityValue(int abilityGroupId, int abilityId) const;
int GetAttributeValue(int attributeGroupId, int abilityId) const; int GetAttributeValue(int attributeGroupId, int abilityId) const;