mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-13 19:54:17 +02:00
Fix json value reader
This commit is contained in:
@@ -43,12 +43,16 @@ namespace JsonRandom
|
||||
size_t index= rng.getIntRange(0, vector.size()-1)();
|
||||
return loadValue(vector[index], rng, 0);
|
||||
}
|
||||
if(value.isStruct())
|
||||
{
|
||||
if (!value["amount"].isNull())
|
||||
return static_cast<si32>(loadValue(value["amount"], rng, defaultValue));
|
||||
si32 min = static_cast<si32>(loadValue(value["min"], rng, 0));
|
||||
si32 max = static_cast<si32>(loadValue(value["max"], rng, 0));
|
||||
return rng.getIntRange(min, max)();
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
std::string loadKey(const JsonNode & value, CRandomGenerator & rng, const std::set<std::string> & valuesSet)
|
||||
{
|
||||
|
Reference in New Issue
Block a user