liquid
This commit is contained in:
@@ -77,6 +77,11 @@ PaddingBounds ComputeRequiredPadding(const Graph& graph, Graph::NodeID outputNod
|
||||
bounds.Include(-d, -d);
|
||||
bounds.Include( d, d);
|
||||
}
|
||||
else if (const auto* ql = dynamic_cast<const LiquidNode*>(n)) {
|
||||
bounds.Include(-ql->maxWidth, 0); // left wall scan
|
||||
bounds.Include( ql->maxWidth, 0); // right wall scan
|
||||
bounds.Include(0, -ql->maxDepth); // ground-below scan
|
||||
}
|
||||
}
|
||||
return bounds;
|
||||
}
|
||||
|
||||
@@ -87,6 +87,11 @@ std::unique_ptr<Node> GraphSerializer::CreateNode(const std::string& type,
|
||||
j.value("tileId", 0),
|
||||
j.value("maxDistance", 4));
|
||||
}
|
||||
if (type == "QueryLiquid") {
|
||||
return std::make_unique<LiquidNode>(
|
||||
j.value("maxWidth", 8),
|
||||
j.value("maxDepth", 4));
|
||||
}
|
||||
|
||||
return nullptr; // unrecognised type
|
||||
}
|
||||
@@ -130,6 +135,9 @@ nlohmann::json GraphSerializer::ToJson(const Graph& g)
|
||||
} else if (const auto* qd = dynamic_cast<const QueryDistanceNode*>(node)) {
|
||||
jNode["tileId"] = qd->tileID;
|
||||
jNode["maxDistance"] = qd->maxDistance;
|
||||
} else if (const auto* ql = dynamic_cast<const LiquidNode*>(node)) {
|
||||
jNode["maxWidth"] = ql->maxWidth;
|
||||
jNode["maxDepth"] = ql->maxDepth;
|
||||
} else if (const auto* mn = dynamic_cast<const MapNode*>(node)) {
|
||||
jNode["min0"] = mn->min0;
|
||||
jNode["max0"] = mn->max0;
|
||||
|
||||
Reference in New Issue
Block a user