1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-12 02:28:11 +02:00

-Fixed abilities for new creatures not being displayed in creature window

-Fixed crash with rank-range limiter used with stack experience disabled
This commit is contained in:
DjWarmonger 2012-09-26 05:13:47 +00:00
parent ecd8947d8e
commit 7759ed017e
2 changed files with 7 additions and 2 deletions

View File

@ -486,6 +486,8 @@ int CStackInstance::getQuantityID() const
int CStackInstance::getExpRank() const
{
if (!VLC->modh->modules.STACK_EXP)
return 0;
int tier = type->level;
if (vstd::iswithin(tier, 1, 7))
{

View File

@ -159,11 +159,14 @@ CCreature * CModHandler::loadCreature (const JsonNode &node)
BOOST_FOREACH (const JsonNode &bonus, node["abilities"].Vector())
{
cre->addNewBonus(ParseBonus(bonus));
auto b = ParseBonus(bonus);
b->duration = Bonus::PERMANENT;
cre->addNewBonus(b);
}
BOOST_FOREACH (const JsonNode &exp, node["stackExperience"].Vector())
{
auto bonus = ParseBonus (exp["bonus"]);
bonus->duration = Bonus::PERMANENT;
const JsonVector &values = exp["values"].Vector();
int lowerLimit = 1, upperLimit = 255;
if (values[0].getType() == JsonNode::JsonType::DATA_BOOL)
@ -172,7 +175,7 @@ CCreature * CModHandler::loadCreature (const JsonNode &node)
{
if (val.Bool() == true)
{
bonus->limiter.reset (new RankRangeLimiter(lowerLimit));
bonus->limiter = make_shared<RankRangeLimiter>(RankRangeLimiter(lowerLimit));
cre->addNewBonus (new Bonus(*bonus)); //bonuses must be unique objects
break; //TODO: allow bonuses to turn off?
}