mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Fix results of merge conflict with Warmonger. + more fixes to barseBonus.
Bonus duration now can be array and parsed to bitmask as designed.
This commit is contained in:
parent
ff4b05ccdd
commit
36469f406c
@ -760,12 +760,12 @@
|
||||
{
|
||||
"type": "NOT_ACTIVE",
|
||||
"subtype": 62,
|
||||
"duration": "UNITL_BEING_ATTACKED N_TURNS",
|
||||
"duration": ["UNITL_BEING_ATTACKED","N_TURNS"],
|
||||
"values":[0,0,0,0]
|
||||
},
|
||||
{
|
||||
"type": "GENERAL_ATTACK_REDUCTION",
|
||||
"duration": "UNITL_BEING_ATTACKED N_TURNS"
|
||||
"duration": ["UNITL_BEING_ATTACKED","N_TURNS"]
|
||||
},
|
||||
{
|
||||
"type": "NO_RETALIATION",
|
||||
@ -836,7 +836,7 @@
|
||||
{
|
||||
"type": "NOT_ACTIVE",
|
||||
"subtype": 62,
|
||||
"duration": "UNITL_BEING_ATTACKED N_TURNS",
|
||||
"duration": ["UNITL_BEING_ATTACKED","N_TURNS"],
|
||||
"values":[0,0,0,0]
|
||||
},
|
||||
{
|
||||
@ -918,7 +918,7 @@
|
||||
{
|
||||
"type": "NOT_ACTIVE",
|
||||
"subtype": 74,
|
||||
"duration": "UNITL_BEING_ATTACKED N_TURNS",
|
||||
"duration": ["UNITL_BEING_ATTACKED","N_TURNS"],
|
||||
"values":[0,0,0,0]
|
||||
},
|
||||
{
|
||||
|
@ -943,7 +943,7 @@ void JsonUtils::resolveIdentifier (si32 &var, const JsonNode &node, std::string
|
||||
});
|
||||
break;
|
||||
default:
|
||||
tlog2 << "Error! Wrong indentifier used for value of " << name;
|
||||
tlog2 << "Error! Wrong indentifier used for value of " << name;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -962,7 +962,7 @@ void JsonUtils::resolveIdentifier (const JsonNode &node, si32 &var)
|
||||
});
|
||||
break;
|
||||
default:
|
||||
tlog2 << "Error! Wrong indentifier used for identifier!";
|
||||
tlog2 << "Error! Wrong indentifier used for identifier!";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1009,20 +1009,41 @@ Bonus * JsonUtils::parseBonus (const JsonNode &ability)
|
||||
|
||||
value = &ability["effectRange"];
|
||||
if (!value->isNull())
|
||||
b->valType = parseByMap(bonusLimitEffect, value, "effect range ");
|
||||
b->effectRange = parseByMap(bonusLimitEffect, value, "effect range ");
|
||||
|
||||
value = &ability["duration"];
|
||||
if (!value->isNull())
|
||||
b->valType = parseByMap(bonusDurationMap, value, "duration type ");
|
||||
{
|
||||
switch (value->getType())
|
||||
{
|
||||
case JsonNode::DATA_STRING:
|
||||
b->duration = parseByMap(bonusDurationMap, value, "duration type ");
|
||||
break;
|
||||
case JsonNode::DATA_VECTOR:
|
||||
{
|
||||
ui16 dur = 0;
|
||||
BOOST_FOREACH (const JsonNode & d, value->Vector())
|
||||
{
|
||||
dur |= parseByMap(bonusDurationMap, &d, "duration type ");
|
||||
}
|
||||
b->duration = dur;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
tlog2 << "Error! Wrong bonus duration format.";
|
||||
}
|
||||
}
|
||||
|
||||
value = &ability["source"];
|
||||
if (!value->isNull())
|
||||
b->valType = parseByMap(bonusSourceMap, value, "source type ");
|
||||
b->source = parseByMap(bonusSourceMap, value, "source type ");
|
||||
|
||||
value = &ability["limiters"];
|
||||
if (!value->isNull())
|
||||
{
|
||||
BOOST_FOREACH (const JsonNode & limiter, value->Vector())
|
||||
{
|
||||
switch (limiter.getType())
|
||||
switch (limiter.getType())
|
||||
{
|
||||
case JsonNode::DATA_STRING: //pre-defined limiters
|
||||
b->limiter = parseByMap(bonusLimiterMap, &limiter, "limiter type ");
|
||||
|
Loading…
Reference in New Issue
Block a user