1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-07-13 01:20:34 +02:00

- Parsing hero specialty is working (though complicated)

- Some obvious fixed for limiters, more work needed
This commit is contained in:
DjWarmonger
2013-01-19 17:38:37 +00:00
parent 97db289d3c
commit 79062eb15c
6 changed files with 63 additions and 16 deletions

View File

@ -1104,6 +1104,20 @@ void CGHeroInstance::initObj() //TODO: use bonus system
attachTo(hs); //do we ever need to detach it?
specialty.push_back(hs); //will it work?
BOOST_FOREACH (auto hs2, type->specialty) //copy active (probably growing) bonuses from hero prootype to hero object
{
HeroSpecial * hs = new HeroSpecial();
hs->setNodeType(CBonusSystemNode::specialty);
BOOST_FOREACH (auto bonus, hs2.bonuses)
{
hs->addNewBonus (bonus);
}
hs->growsWithLevel = hs2.growsWithLevel;
attachTo(hs); //do we ever need to detach it?
specialty.push_back(hs); //will it work?
}
//initialize bonuses
BOOST_FOREACH(auto skill_info, secSkills)
updateSkill(skill_info.first, skill_info.second);
@ -1133,9 +1147,9 @@ void CGHeroInstance::Updatespecialty() //TODO: calculate special value of bonuse
CCreature * cre = NULL;
int creLevel = 0;
TLimiterPtr limiterNode (b);
while (limiterNode->next)
while (limiterNode->limiter)
{
limiterNode = limiterNode->next; //search list
limiterNode = limiterNode->limiter; //search list
if (foundLimiter = dynamic_cast<CCreatureTypeLimiter*>(limiterNode.get())) //TODO: more general eveluation of bonuses?
{
cre = const_cast<CCreature*>(foundLimiter->creature);