1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

vcmi: move obligatory marker to CSkillHandler

It is working, now it is possible to
define other obligatory skills than wisdom or magic schools,
but only 2 types of obligatory skills exists - like wisdom and
like magic school
This commit is contained in:
Konstantin
2023-02-27 12:42:57 +03:00
parent 4acf3778ef
commit f26fac5562
5 changed files with 61 additions and 28 deletions

View File

@@ -33,8 +33,8 @@ CSkill::LevelInfo::~LevelInfo()
{
}
CSkill::CSkill(SecondarySkill id, std::string identifier)
: id(id), identifier(identifier)
CSkill::CSkill(SecondarySkill id, std::string identifier, bool obligatoryMajor, bool obligatoryMinor)
: id(id), identifier(identifier), obligatoryMajor(obligatoryMajor), obligatoryMinor(obligatoryMinor)
{
gainChance[0] = gainChance[1] = 0; //affects CHeroClassHandler::afterLoadFinalization()
levels.resize(NSecondarySkill::levels.size() - 1);
@@ -207,8 +207,11 @@ CSkill * CSkillHandler::loadFromJson(const std::string & scope, const JsonNode &
{
assert(identifier.find(':') == std::string::npos);
assert(!scope.empty());
bool major, minor;
CSkill * skill = new CSkill(SecondarySkill((si32)index), identifier);
major = json["obligatoryMajor"].Bool();
minor = json["obligatoryMinor"].Bool();
CSkill * skill = new CSkill(SecondarySkill((si32)index), identifier, major, minor);
skill->modScope = scope;
VLC->generaltexth->registerString(scope, skill->getNameTextID(), json["name"].String());