Implements CGSpendVirtuePoints.
This commit is contained in:
@@ -257,6 +257,12 @@ void CharacterType::FillVirtueValues(std::vector<int>& values) const {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vector<int> CharacterType::GetVirtueValues() const {
|
||||||
|
vector<int> values;
|
||||||
|
FillVirtueValues(values);
|
||||||
|
return values;
|
||||||
|
}
|
||||||
|
|
||||||
void CharacterType::FillAttributeValues(std::vector<int>& values, int group_id) const {
|
void CharacterType::FillAttributeValues(std::vector<int>& values, int group_id) const {
|
||||||
// TODO: This method sucks, but was needed in QBasic.
|
// TODO: This method sucks, but was needed in QBasic.
|
||||||
const int numAttributes = GetNumAttributesInGroup(group_id);
|
const int numAttributes = GetNumAttributesInGroup(group_id);
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ class CharacterType {
|
|||||||
int GetSocialAttributeValue(int id) const;
|
int GetSocialAttributeValue(int id) const;
|
||||||
int GetTalentValue(int id) const;
|
int GetTalentValue(int id) const;
|
||||||
int GetVirtueValue(int id) const;
|
int GetVirtueValue(int id) const;
|
||||||
|
std::vector<int> GetVirtueValues() const;
|
||||||
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);
|
||||||
|
|||||||
@@ -4,19 +4,28 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
namespace SBF {
|
namespace SBF {
|
||||||
|
namespace {
|
||||||
|
using std::string;
|
||||||
|
using std::vector;
|
||||||
|
} // End namespace
|
||||||
|
|
||||||
const std::string GetVirtueLabel(int id) {
|
const string GetVirtueLabel(int id) {
|
||||||
if (id > 0 && id <= kVirtuesCount) {
|
if (id > 0 && id <= kVirtuesCount) {
|
||||||
return kVirtueLabels[id];
|
return kVirtueLabels[id];
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
void FillVirtueLabels(std::vector<std::string>& labels) {
|
void FillVirtueLabels(vector<string>& labels) {
|
||||||
labels.clear();
|
labels.clear();
|
||||||
for (int id = 1; id <= kVirtuesCount; id++) {
|
for (int id = 1; id <= kVirtuesCount; id++) {
|
||||||
labels.push_back(GetVirtueLabel(id));
|
labels.push_back(GetVirtueLabel(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vector<string> GetVirtueLabels() {
|
||||||
|
vector<string> labels;
|
||||||
|
FillVirtueLabels(labels);
|
||||||
|
return labels;
|
||||||
|
}
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|||||||
@@ -39,6 +39,8 @@ const std::string GetVirtueLabel(int virtue_id);
|
|||||||
/// @brief Fills the vector with all of the valid virtue labels.
|
/// @brief Fills the vector with all of the valid virtue labels.
|
||||||
/// @param virtue_labels The vector to fill. It will be cleared first.
|
/// @param virtue_labels The vector to fill. It will be cleared first.
|
||||||
void FillVirtueLabels(std::vector<std::string>& virtue_labels);
|
void FillVirtueLabels(std::vector<std::string>& virtue_labels);
|
||||||
|
|
||||||
|
std::vector<std::string> GetVirtueLabels();
|
||||||
} // End namespace SBF
|
} // End namespace SBF
|
||||||
|
|
||||||
/** @}*/
|
/** @}*/
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
|
#include "sbf-cpp/Virtues.h"
|
||||||
#define _XOPEN_SOURCE_EXTENDED
|
#define _XOPEN_SOURCE_EXTENDED
|
||||||
#include "sbf.h"
|
|
||||||
|
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
@@ -17,6 +16,7 @@
|
|||||||
#include "Menus.h"
|
#include "Menus.h"
|
||||||
#include "Random.h"
|
#include "Random.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
#include "sbf.h"
|
||||||
|
|
||||||
#define KEY_ESCAPE 0033
|
#define KEY_ESCAPE 0033
|
||||||
|
|
||||||
@@ -319,8 +319,17 @@ void CGGetRoad(CharacterType& ch) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CGSpendVirtuePoints(CharacterType& ch) {
|
void CGSpendVirtuePoints(CharacterType& ch) {
|
||||||
// TODO: Fill this in.
|
// Spend virtue points
|
||||||
cout << "// TODO: CGSpendVirtuePoints(CharacterType&)" << endl;
|
MenuStyle ms;
|
||||||
|
int virtue_points = GetVirtuePoints();
|
||||||
|
vector<string> labels = GetVirtueLabels();
|
||||||
|
while (virtue_points > 0) {
|
||||||
|
vector<int> values = ch.GetVirtueValues();
|
||||||
|
int virtue_id = ChooseStringIdWithValues(
|
||||||
|
labels, values, ms, "Which virtue do you want to spend 1 of your " + to_string(virtue_points) + " points on?");
|
||||||
|
ch.SetVirtueValue(virtue_id, ch.GetVirtueValue(virtue_id) + 1);
|
||||||
|
virtue_points--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGGetDerangement(CharacterType& ch) {
|
void CGGetDerangement(CharacterType& ch) {
|
||||||
|
|||||||
Reference in New Issue
Block a user