Fixes Character Fill* methods and some getters.
This commit is contained in:
@@ -1,10 +1,12 @@
|
|||||||
#include "Character.h"
|
#include "Character.h"
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "Attributes.h"
|
#include "Attributes.h"
|
||||||
|
#include "sbf-cpp/Disciplines.h"
|
||||||
|
|
||||||
namespace SBF {
|
namespace SBF {
|
||||||
namespace {
|
namespace {
|
||||||
@@ -201,7 +203,7 @@ int GetDisciplinePoints() {
|
|||||||
return kDisciplinePoints;
|
return kDisciplinePoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterType::FillDisciplineValues(std::vector<int> values) const {
|
void CharacterType::FillDisciplineValues(std::vector<int>& values) const {
|
||||||
// TODO: This method sucks, but was needed in QBasic.
|
// TODO: This method sucks, but was needed in QBasic.
|
||||||
values.clear();
|
values.clear();
|
||||||
values.push_back(0); // To pad the indexes.
|
values.push_back(0); // To pad the indexes.
|
||||||
@@ -210,6 +212,12 @@ void CharacterType::FillDisciplineValues(std::vector<int> values) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vector<int> CharacterType::GetDisciplineValues() const {
|
||||||
|
vector<int> values;
|
||||||
|
FillDisciplineValues(values);
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
int GetVirtuePoints() {
|
int GetVirtuePoints() {
|
||||||
return kVirtuePoints;
|
return kVirtuePoints;
|
||||||
}
|
}
|
||||||
@@ -241,7 +249,7 @@ int CharacterType::GetVirtueValue(int virtueId) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterType::FillVirtueValues(std::vector<int> virtueValues) const {
|
void CharacterType::FillVirtueValues(std::vector<int>& virtueValues) const {
|
||||||
// TODO: This method sucks, but was needed in QBasic.
|
// TODO: This method sucks, but was needed in QBasic.
|
||||||
virtueValues.clear();
|
virtueValues.clear();
|
||||||
for (int id = 0; id <= kVirtuesCount; id++) {
|
for (int id = 0; id <= kVirtuesCount; id++) {
|
||||||
@@ -249,15 +257,21 @@ void CharacterType::FillVirtueValues(std::vector<int> virtueValues) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterType::FillAttributeValues(std::vector<int> attributeValues, int attributeGroupId) const {
|
void CharacterType::FillAttributeValues(std::vector<int>& attributeValues, int attributeGroupId) const {
|
||||||
// TODO: This method sucks, but was needed in QBasic.
|
// TODO: This method sucks, but was needed in QBasic.
|
||||||
const int numAttributes = GetNumAttributesInGroup(attributeGroupId);
|
const int numAttributes = GetNumAttributesInGroup(attributeGroupId);
|
||||||
attributeValues.clear();
|
attributeValues.clear();
|
||||||
for (int attributeId = 0; attributeId <= numAttributes; attributeId++) {
|
for (int attributeId = 1; attributeId <= numAttributes; attributeId++) {
|
||||||
attributeValues[attributeId] = GetAttributeValue(attributeGroupId, attributeId);
|
attributeValues.push_back(GetAttributeValue(attributeGroupId, attributeId));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vector<int> CharacterType::GetAttributeValuesInGroup(int group_id) const {
|
||||||
|
vector<int> values;
|
||||||
|
FillAttributeValues(values, group_id);
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
void FillAttributeLabelsInGroup(std::vector<string> attributeLabels, int attributeGroupId) {
|
void FillAttributeLabelsInGroup(std::vector<string> attributeLabels, int attributeGroupId) {
|
||||||
attributeLabels.clear();
|
attributeLabels.clear();
|
||||||
switch (attributeGroupId) {
|
switch (attributeGroupId) {
|
||||||
@@ -304,10 +318,13 @@ void CharacterType::SetPhysicalAttributeValue(int id, int value) {
|
|||||||
switch (id) {
|
switch (id) {
|
||||||
case kPhysicalAttributeDexterityId:
|
case kPhysicalAttributeDexterityId:
|
||||||
attr_dexterity = value;
|
attr_dexterity = value;
|
||||||
|
break;
|
||||||
case kPhysicalAttributeStaminaId:
|
case kPhysicalAttributeStaminaId:
|
||||||
attr_stamina = value;
|
attr_stamina = value;
|
||||||
|
break;
|
||||||
case kPhysicalAttributeStrengthId:
|
case kPhysicalAttributeStrengthId:
|
||||||
attr_strength = value;
|
attr_strength = value;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,10 +332,13 @@ void CharacterType::SetSocialAttributeValue(int id, int value) {
|
|||||||
switch (id) {
|
switch (id) {
|
||||||
case kSocialAttributeAppearanceId:
|
case kSocialAttributeAppearanceId:
|
||||||
attr_appearance = value;
|
attr_appearance = value;
|
||||||
|
break;
|
||||||
case kSocialAttributeCharismaId:
|
case kSocialAttributeCharismaId:
|
||||||
attr_charisma = value;
|
attr_charisma = value;
|
||||||
|
break;
|
||||||
case kSocialAttributeManipulationId:
|
case kSocialAttributeManipulationId:
|
||||||
attr_manipulation = value;
|
attr_manipulation = value;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -326,10 +346,13 @@ void CharacterType::SetMentalAttributeValue(int id, int value) {
|
|||||||
switch (id) {
|
switch (id) {
|
||||||
case kMentalAttributeIntelligenceId:
|
case kMentalAttributeIntelligenceId:
|
||||||
attr_intelligence = value;
|
attr_intelligence = value;
|
||||||
|
break;
|
||||||
case kMentalAttributePerceptionId:
|
case kMentalAttributePerceptionId:
|
||||||
attr_perception = value;
|
attr_perception = value;
|
||||||
|
break;
|
||||||
case kMentalAttributeWitsId:
|
case kMentalAttributeWitsId:
|
||||||
attr_wits = value;
|
attr_wits = value;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,7 +468,7 @@ int GetAbilityPointsForRank(int rankId) {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterType::FillAbilityValues(std::vector<int> abilityValues, int abilityGroupId) const {
|
void CharacterType::FillAbilityValues(std::vector<int>& abilityValues, int abilityGroupId) const {
|
||||||
int numAbilities = GetNumItemsForAbilityGroup(abilityGroupId);
|
int numAbilities = GetNumItemsForAbilityGroup(abilityGroupId);
|
||||||
abilityValues.clear();
|
abilityValues.clear();
|
||||||
for (int abilityId = 0; abilityId <= numAbilities; abilityId++) {
|
for (int abilityId = 0; abilityId <= numAbilities; abilityId++) {
|
||||||
@@ -697,7 +720,7 @@ int CharacterType::GetBackgroundValue(int backgroundId) const {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CharacterType::FillBackgroundValues(std::vector<int> values) const {
|
void CharacterType::FillBackgroundValues(std::vector<int>& values) const {
|
||||||
values.clear();
|
values.clear();
|
||||||
values.push_back(0); // To pad the indexes.
|
values.push_back(0); // To pad the indexes.
|
||||||
for (int backgroundId = 1; backgroundId <= kBackgroundsCount; backgroundId++) {
|
for (int backgroundId = 1; backgroundId <= kBackgroundsCount; backgroundId++) {
|
||||||
|
|||||||
@@ -26,25 +26,28 @@
|
|||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
namespace SBF {
|
namespace SBF {
|
||||||
|
int GetAttributePointsForRank(int rankId);
|
||||||
int GetDisciplinePoints();
|
int GetDisciplinePoints();
|
||||||
int GetVirtuePoints();
|
int GetVirtuePoints();
|
||||||
|
|
||||||
class CharacterType {
|
class CharacterType {
|
||||||
public:
|
public:
|
||||||
CharacterType();
|
CharacterType();
|
||||||
void FillAbilityValues(std::vector<int> abilityValues, int abilityGroupId) const;
|
void FillAbilityValues(std::vector<int>& abilityValues, int abilityGroupId) const;
|
||||||
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 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;
|
||||||
|
std::vector<int> GetAttributeValuesInGroup(int group_id) const;
|
||||||
int GetPhysicalAttributeValue(int id) const;
|
int GetPhysicalAttributeValue(int id) const;
|
||||||
int GetSocialAttributeValue(int id) const;
|
int GetSocialAttributeValue(int id) const;
|
||||||
int GetMentalAttributeValue(int id) const;
|
int GetMentalAttributeValue(int id) const;
|
||||||
int GetBackgroundValue(int backgroundId) const;
|
int GetBackgroundValue(int backgroundId) const;
|
||||||
std::string GetAllDerangementsLine() const;
|
std::string GetAllDerangementsLine() const;
|
||||||
int GetDisciplineValue(int disciplineId) const;
|
int GetDisciplineValue(int disciplineId) const;
|
||||||
|
std::vector<int> GetDisciplineValues() const;
|
||||||
int GetKnowledgeValue(int knowledgeId) const;
|
int GetKnowledgeValue(int knowledgeId) const;
|
||||||
int GetSkillValue(int skillId) const;
|
int GetSkillValue(int skillId) const;
|
||||||
int GetTalentValue(int talentId) const;
|
int GetTalentValue(int talentId) const;
|
||||||
|
|||||||
Reference in New Issue
Block a user