mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-29 23:07:48 +02:00
- Parsing hero specialty is working (though complicated)
- Some obvious fixed for limiters, more work needed
This commit is contained in:
@@ -9,6 +9,7 @@
|
||||
#include "BattleHex.h"
|
||||
#include "CModHandler.h"
|
||||
#include "CTownHandler.h"
|
||||
#include "CObjectHandler.h" //for hero specialty
|
||||
|
||||
/*
|
||||
* CHeroHandler.cpp, part of VCMI engine
|
||||
@@ -285,6 +286,7 @@ void CHeroHandler::loadHeroJson(CHero * hero, const JsonNode & node)
|
||||
hero->spells.insert(spell.Float());
|
||||
}
|
||||
|
||||
//deprecated, used only for original spciealties
|
||||
BOOST_FOREACH(const JsonNode &specialty, node["specialties"].Vector())
|
||||
{
|
||||
SSpecialtyInfo spec;
|
||||
@@ -296,6 +298,18 @@ void CHeroHandler::loadHeroJson(CHero * hero, const JsonNode & node)
|
||||
|
||||
hero->spec.push_back(spec); //put a copy of dummy
|
||||
}
|
||||
//new format, using bonus system
|
||||
BOOST_FOREACH(const JsonNode &specialty, node["specialty"].Vector())
|
||||
{
|
||||
SSpecialtyBonus hs;
|
||||
hs.growsWithLevel = specialty["growsWithLevel"].Bool();
|
||||
BOOST_FOREACH (const JsonNode & bonus, specialty["bonuses"].Vector())
|
||||
{
|
||||
auto b = JsonUtils::parseBonus(bonus);
|
||||
hs.bonuses.push_back (b);
|
||||
}
|
||||
hero->specialty.push_back (hs); //now, how to get CGHeroInstance from it?
|
||||
}
|
||||
|
||||
VLC->modh->identifiers.requestIdentifier("heroClass." + node["class"].String(),
|
||||
[=](si32 classID)
|
||||
|
||||
Reference in New Issue
Block a user