1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-23 00:28:08 +02:00

Basic Configuration for bonus types

* introduced new handler BonusTypeHandler
* config\bonusnames.json converted to common format and splitted info main and localizable parts
* hanlders initialization refactored
This commit is contained in:
alexvins
2013-03-06 18:49:56 +00:00
parent 6b5ee0b674
commit 2eb8263e51
28 changed files with 1481 additions and 517 deletions

View File

@ -127,10 +127,7 @@ void CCreature::addBonus(int val, Bonus::BonusType type, int subtype /*= -1*/)
Bonus *added = new Bonus(Bonus::PERMANENT, type, Bonus::CREATURE_ABILITY, val, idNumber, subtype, Bonus::BASE_NUMBER);
addNewBonus(added);
}
// void CCreature::getParents(TCNodes &out, const CBonusSystemNode *root /*= NULL*/) const
// {
// out.insert (VLC->creh->globalEffects);
// }
bool CCreature::isMyUpgrade(const CCreature *anotherCre) const
{
//TODO upgrade of upgrade?
@ -251,7 +248,8 @@ void CCreatureHandler::loadBonuses(CCreature & ncre, std::string bonuses)
}
}
void CCreatureHandler::loadCreatures()
void CCreatureHandler::load()
{
tlog5 << "\t\tReading ZCRTRAIT.TXT" << std::endl;
@ -373,24 +371,6 @@ void CCreatureHandler::loadCreatures()
loadAnimationInfo();
//reading creature ability names
const JsonNode config2(ResourceID("config/bonusnames.json"));
BOOST_FOREACH(const JsonNode &bonus, config2["bonuses"].Vector())
{
const std::string bonusID = bonus["id"].String();
auto it_map = bonusNameMap.find(bonusID);
if (it_map != bonusNameMap.end())
stackBonuses[it_map->second] = std::pair<std::string, std::string>(bonus["name"].String(), bonus["description"].String());
else
tlog2 << "Bonus " << bonusID << " not recognized, ignoring\n";
}
//handle magic resistance secondary skill premy, potentialy may be buggy
//std::map<Bonus::BonusType, std::pair<std::string, std::string> >::iterator it = stackBonuses.find(Bonus::MAGIC_RESISTANCE);
//stackBonuses[Bonus::SECONDARY_SKILL_PREMY] = std::pair<std::string, std::string>(it->second.first, it->second.second);
if (VLC->modh->modules.STACK_EXP) //reading default stack experience bonuses
{
CLegacyConfigParser parser("DATA/CREXPBON.TXT");