mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Reworked JsonNode constructors to more logical form
This commit is contained in:
@@ -354,11 +354,7 @@ void ObjectTemplate::writeJson(JsonNode & node, const bool withTerrain) const
|
||||
JsonVector & data = node["allowedTerrains"].Vector();
|
||||
|
||||
for(auto type : allowedTerrains)
|
||||
{
|
||||
JsonNode value(JsonNode::JsonType::DATA_STRING);
|
||||
value.String() = VLC->terrainTypeHandler->getById(type)->getJsonKey();
|
||||
data.push_back(value);
|
||||
}
|
||||
data.push_back(JsonNode(VLC->terrainTypeHandler->getById(type)->getJsonKey()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -398,13 +394,11 @@ void ObjectTemplate::writeJson(JsonNode & node, const bool withTerrain) const
|
||||
|
||||
for(size_t i=0; i < height; i++)
|
||||
{
|
||||
JsonNode lineNode(JsonNode::JsonType::DATA_STRING);
|
||||
|
||||
std::string & line = lineNode.String();
|
||||
std::string line;
|
||||
line.resize(width);
|
||||
for(size_t j=0; j < width; j++)
|
||||
line[j] = tileToChar(usedTiles[height - 1 - i][width - 1 - j]);
|
||||
mask.push_back(lineNode);
|
||||
mask.emplace_back(line);
|
||||
}
|
||||
|
||||
if(printPriority != 0)
|
||||
|
||||
Reference in New Issue
Block a user