mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Change JsonType to enum class (#393)
Change enum JsonType to enum class JsonType
This commit is contained in:
committed by
Alexander Shishkin
parent
6df536bb31
commit
26a222ac62
@@ -69,7 +69,7 @@ namespace JsonRandom
|
||||
|
||||
ArtifactID loadArtifact(const JsonNode & value, CRandomGenerator & rng)
|
||||
{
|
||||
if (value.getType() == JsonNode::DATA_STRING)
|
||||
if (value.getType() == JsonNode::JsonType::DATA_STRING)
|
||||
return ArtifactID(VLC->modh->identifiers.getIdentifier("artifact", value).get());
|
||||
|
||||
std::set<CArtifact::EartClass> allowedClasses;
|
||||
@@ -77,13 +77,13 @@ namespace JsonRandom
|
||||
ui32 minValue = 0;
|
||||
ui32 maxValue = std::numeric_limits<ui32>::max();
|
||||
|
||||
if (value["class"].getType() == JsonNode::DATA_STRING)
|
||||
if (value["class"].getType() == JsonNode::JsonType::DATA_STRING)
|
||||
allowedClasses.insert(VLC->arth->stringToClass(value["class"].String()));
|
||||
else
|
||||
for (auto & entry : value["class"].Vector())
|
||||
allowedClasses.insert(VLC->arth->stringToClass(entry.String()));
|
||||
|
||||
if (value["slot"].getType() == JsonNode::DATA_STRING)
|
||||
if (value["slot"].getType() == JsonNode::JsonType::DATA_STRING)
|
||||
allowedPositions.insert(VLC->arth->stringToSlot(value["class"].String()));
|
||||
else
|
||||
for (auto & entry : value["slot"].Vector())
|
||||
@@ -127,9 +127,9 @@ namespace JsonRandom
|
||||
|
||||
SpellID loadSpell(const JsonNode & value, CRandomGenerator & rng, std::vector<SpellID> spells)
|
||||
{
|
||||
if (value.getType() == JsonNode::DATA_STRING)
|
||||
if (value.getType() == JsonNode::JsonType::DATA_STRING)
|
||||
return SpellID(VLC->modh->identifiers.getIdentifier("spell", value).get());
|
||||
if (value["type"].getType() == JsonNode::DATA_STRING)
|
||||
if (value["type"].getType() == JsonNode::JsonType::DATA_STRING)
|
||||
return SpellID(VLC->modh->identifiers.getIdentifier("spell", value["type"]).get());
|
||||
|
||||
vstd::erase_if(spells, [=](SpellID spell)
|
||||
|
||||
Reference in New Issue
Block a user