From 0de1a37d65bc7575600e787e5d8ffb1ed9d3048c Mon Sep 17 00:00:00 2001 From: AlexVinS Date: Fri, 26 Feb 2016 01:01:07 +0300 Subject: [PATCH] Fix missing template zIndex saving --- lib/mapObjects/ObjectTemplate.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/mapObjects/ObjectTemplate.cpp b/lib/mapObjects/ObjectTemplate.cpp index 57e55eb7c..af45b16ad 100644 --- a/lib/mapObjects/ObjectTemplate.cpp +++ b/lib/mapObjects/ObjectTemplate.cpp @@ -252,11 +252,7 @@ void ObjectTemplate::readJson(const JsonNode &node, const bool withTerrain) usedTiles[mask.size() - 1 - i][line.size() - 1 - j] = charToTile(line[j]); } - const JsonNode zindex = node["zIndex"]; - if (!zindex.isNull()) - printPriority = node["zIndex"].Float(); - else - printPriority = 0; //default value + printPriority = node["zIndex"].Float(); } void ObjectTemplate::writeJson(JsonNode & node, const bool withTerrain) const @@ -344,6 +340,9 @@ void ObjectTemplate::writeJson(JsonNode & node, const bool withTerrain) const line[j] = tileToChar(usedTiles[height - 1 - i][width - 1 - j]); mask.push_back(lineNode); } + + if(printPriority != 0) + node["zIndex"].Float() = printPriority; } ui32 ObjectTemplate::getWidth() const