mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Fix Campfire Gold reward amount. Now always one of 400/500/600
This commit is contained in:
parent
d82822d37a
commit
a2cd17197e
@ -35,8 +35,7 @@
|
||||
},
|
||||
{
|
||||
"type" : "gold",
|
||||
"min" : 400,
|
||||
"max" : 600
|
||||
"amount" : [ 400, 500, 600 ]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -31,10 +31,17 @@ namespace JsonRandom
|
||||
return defaultValue;
|
||||
if (value.isNumber())
|
||||
return static_cast<si32>(value.Float());
|
||||
if (value.isVector())
|
||||
{
|
||||
const auto & vector = value.Vector();
|
||||
|
||||
size_t index= rng.getIntRange(0, vector.size()-1)();
|
||||
return loadValue(vector[index], rng, 0);
|
||||
}
|
||||
if (!value["amount"].isNull())
|
||||
return static_cast<si32>(loadValue(value["amount"], rng, defaultValue));
|
||||
si32 min = static_cast<si32>(value["min"].Float());
|
||||
si32 max = static_cast<si32>(value["max"].Float());
|
||||
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)();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user