载入中...
搜索中...
未找到
RoadNetworkCodec.cpp
浏览该文件的文档.
18 return Result<T>::failure(Diagnostic::error(DiagnosticCode::InvalidArgument, message, "networkSnapshot"));
20bool withinBudget(const eve::Value& value, std::size_t depth, std::size_t& elements, std::size_t& bytes) {
41 if (network.nodes().size() > 65536 || network.edges().size() > 65536 || network.laneLinks().size() > 262144 ||
45 if (edge.controlPoints.size() > 4096) return invalid<eve::Value>("Road snapshot exceeds the marker budget");
59 for (const auto& link : network.blockedLaneLinks()) blockedLaneLinks.push_back(encodeLink(link));
86 if (!schema || *schema != "eve.procgen.roadNetwork" || !version || *version != 1 || !nodes || !edges || !links ||
90 if (nodes->size() > maximumNodes || edges->size() > maximumEdges || links->size() > maximumLinks ||
97 if (!decodeNodeRecord(encoded, node)) return invalid<RoadNetwork>("Road snapshot contains an invalid node");
111 if (!decodeLink(encoded, link)) return invalid<RoadNetwork>("Road snapshot contains an invalid lane link");
static Diagnostic error(DiagnosticCode code, std::string message, std::string path={})
Construct an error diagnostic with the standard error severity.
Definition Diagnostic.cpp:21
static Result failure(Status status)
Construct a failed result from a structured status.
Definition Result.h:196
Owning directed road graph with lane connectivity.
Definition RoadNetwork.h:19
Result< void > addLaneLink(RoadLaneConnection link)
Register one legal turn inside a shared junction node.
Definition RoadNetwork.cpp:291
Result< void > restoreNode(RoadNode node)
Restore a node with an explicit stable id for undo/import paths.
Definition RoadNetwork.cpp:147
Result< void > validate() const
Validate graph, endpoint and lane-link invariants without mutation.
Definition RoadNetwork.cpp:404
Result< bool > blockLaneLink(RoadLaneConnection link)
Persistently forbid one exact legal lane connection and remove it if currently active.
Definition RoadNetwork.cpp:307
const std::vector< RoadLaneConnection > & laneLinks() const noexcept
Lane links.
Definition RoadNetwork.h:267
const std::vector< RoadLaneConnection > & blockedLaneLinks() const noexcept
Borrow deterministic persistent turn prohibitions until the next network mutation.
Definition RoadNetwork.h:269
Result< void > restoreEdge(RoadEdge edge)
Restore an edge with an explicit stable id for undo/import paths.
Definition RoadNetwork.cpp:225
Definition TerrainWorldWorkspace.h:12
Result< eve::Value > captureRoadNetwork(const RoadNetwork &network)
Capture validated, owning author data using the editor-compatible roadNetwork schema v1....
Definition RoadNetworkCodec.cpp:38
Result< RoadNetwork > restoreRoadNetwork(const eve::Value &snapshot)
Decode schema v1 privately; unknown fields are ignored and unsupported versions rejected.
Definition RoadNetworkCodec.cpp:70
EditorValue RoadCodecValue
Definition RoadNetworkConnectionCodec.cpp:7
bool readSmallInt(const EditorValue &value, const char *name, int minimum, int maximum, int &output)
@ InvalidArgument
Directed centerline edge with optional reverse lanes.
Definition RoadTypes.h:286
std::vector< RoadControlPoint > controlPoints
Definition RoadTypes.h:290
One legal lane-to-lane connection inside a junction.
Definition RoadTypes.h:315