This commit is contained in:
Connor
2026-02-24 17:22:41 +09:00
parent 1b7fd1c7f8
commit bee5aa0e8f
8 changed files with 1113 additions and 123 deletions

View File

@@ -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;
}

View File

@@ -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;