1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-03-25 21:38:59 +02:00

vcmi: adjust parseBonus and Bonus::toJson

This was an error, when scheme and parser asks different values for
source type. Corrected this.
This commit is contained in:
Konstantin 2023-02-13 11:52:11 +03:00
parent 129b5313c5
commit b99a2ad669
2 changed files with 2 additions and 2 deletions

@ -1708,7 +1708,7 @@ JsonNode Bonus::toJsonNode() const
if(turnsRemain != 0)
root["turns"].Integer() = turnsRemain;
if(source != OTHER)
root["source"].String() = vstd::findKey(bonusSourceMap, source);
root["sourceType"].String() = vstd::findKey(bonusSourceMap, source);
if(sid != 0)
root["sourceID"].Integer() = sid;
if(val != 0)

@ -845,7 +845,7 @@ bool JsonUtils::parseBonus(const JsonNode &ability, Bonus *b)
}
}
value = &ability["source"];
value = &ability["sourceType"];
if (!value->isNull())
b->source = static_cast<Bonus::BonusSource>(parseByMap(bonusSourceMap, value, "source type "));