载入中...
搜索中...
未找到
PlacementRestore.cpp
浏览该文件的文档.
20PlacementRestoreStatus PlacementSystem::restoreExact(PlacementWorld *world, const PlacedBuilding &placed,
37 if (!canPlaceFree(world, placed.buildingId, placed.worldX, placed.worldY, 0, reason, placed.level,
43 grid::worldToCell(*world->grid_, restored.worldX, restored.worldY, restored.originCellX, restored.originCellY,
70 if (!canPlaceCorner(world, placed.buildingId, placed.corner.x, placed.corner.y, 0, reason, placed.level))
105 if (!canPlaceEdge(world, placed.buildingId, placed.edge.x, placed.edge.y, direction, 0, reason, placed.level))
182 if (!world || !group.id || group.controlPoints.size() != 4 || group.subdivisions < 2 || group.subdivisions > 4096 ||
186 "curve group restore requires a world, identity, four controls, valid subdivisions and matching members",
192 if (member.instanceId <= 0 || member.instanceId != group.instanceIds[index] || member.placementKind != "edge" ||
204 eve::Diagnostic::error(eve::DiagnosticCode::InvalidArgument, "curve group controls must be finite", {},
208 if ((!group.surfaceSamples.empty() && group.surfaceSamples.size() != static_cast<size_t>(group.subdivisions + 1)) ||
210 (!group.surfaceProviderName.empty() || !group.surfaceId.empty() || group.surfaceRevision != 0))) {
217 const float normalLength = std::sqrt(sample.normalX * sample.normalX + sample.normalY * sample.normalY +
219 if (!std::isfinite(sample.worldX) || !std::isfinite(sample.worldY) || !std::isfinite(sample.worldZ) ||
238 eve::DiagnosticCode::Conflict, "curve group member restore was rejected without destination mutation",
242 for (int instanceId : group.instanceIds) candidate->buildings_.at(instanceId).edgeCurveGroupId = group.id;
244 candidate->nextEdgeCurveGroupId_ = std::max(candidate->nextEdgeCurveGroupId_, group.id.value + 1);
std::map< std::string, std::vector< Key >, std::less<> > channels
Definition AnimCurveLibrary.cpp:21
Stable, structured diagnostics shared by engine modules.
Pure cell/world projection helpers for GridConfig.
std::map< std::string, std::span< const std::uint8_t > > members
Definition UnityPackage.cpp:81
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
static PlacementRestoreStatus restoreExact(PlacementWorld *world, const PlacedBuilding &placed, std::string *reason=nullptr)
Restore an exact persistent instance for editor undo or snapshot loading.
Definition PlacementRestore.cpp:20
static bool canPlaceFree(PlacementWorld *world, const std::string &buildingId, float worldX, float worldY, int excludeInstanceId=0, std::string *reason=nullptr, int level=std::numeric_limits< int >::min(), float rotationDeg=0.f)
Validate an exact free-domain world-plane anchor and circular or oriented-box footprint.
Definition PlacementDomains.cpp:240
static float normalizeRotation(const std::string &buildingId, float rotationDeg)
规范化旋转角(cardinal → 0/90/180/270;none → 0)。
Definition PlacementSystem.cpp:457
static bool canPlaceCorner(PlacementWorld *world, const std::string &buildingId, int vertexX, int vertexY, int excludeInstanceId=0, std::string *reason=nullptr, int level=std::numeric_limits< int >::min())
Validate a corner-domain placement at one canonical grid vertex.
Definition PlacementDomains.cpp:148
static bool canPlaceElev(PlacementWorld *world, const std::string &buildingId, int cellX, int cellY, float elevation, float rotationDeg=0.f, int excludeInstanceId=0, std::string *reason=nullptr, int level=std::numeric_limits< int >::min())
Definition PlacementValidation.cpp:147
static eve::Result< EdgeCurveGroup > restoreEdgeCurveGroupExact(PlacementWorld *world, const EdgeCurveGroup &group, const std::vector< PlacedBuilding > &members)
Atomically restore an exact curve group and all of its exact-id edge members.
Definition PlacementRestore.cpp:179
static bool canPlaceEdge(PlacementWorld *world, const std::string &buildingId, int cellX, int cellY, const std::string &direction, int excludeInstanceId=0, std::string *reason=nullptr, int level=std::numeric_limits< int >::min())
Validate an edge-domain placement without mutating the world.
Definition PlacementDomains.cpp:42
void applyDefinitionFreeFootprint(PlacedBuilding &placed, const BuildingDefinition &definition, const PlacementWorld &world)
Definition PlacementGeometry.cpp:85
建筑放置模块入口:定义 / 放置世界 / 鬼影 / 变更事件的脚本绑定点。 设计文档:docs/dev/建筑放置系统设计.md
Definition Building.cpp:10
PlacementRestoreStatus
Outcome of restoring an exact placement snapshot.
Definition PlacementSystem.h:28
@ Horizontal
void worldToCell(const GridConfig &cfg, float px, float py, int &cx, int &cy, int mapW, int mapH)
Maps planar coordinates to the nearest cell. Staggered/hex layouts use a bounded nearest-neighbor sea...
Definition GridProjection.cpp:69
@ InvalidArgument
@ Conflict
std::string placementKind
Placement domain: cell (default), edge, corner, or free.
Definition BuildingTypes.h:111
std::vector< std::string > tags
Definition BuildingTypes.h:146
One cubic Bezier control point in logical grid-vertex space.
Definition BuildingTypes.h:59
World-owned authoritative description and membership of one committed edge curve.
Definition BuildingTypes.h:81
One committed 3D centerline frame sampled from a custom placement surface.
Definition BuildingTypes.h:68
EdgeCurveGroupId edgeCurveGroupId
Optional link to a world-owned curve group; zero means an ordinary edge.
Definition BuildingTypes.h:197
int level
Authoritative discrete floor coordinate used by occupancy and topology.
Definition BuildingTypes.h:211
std::string placementKind
Placement domain snapshot: cell, edge, corner, or free.
Definition BuildingTypes.h:193
std::vector< int > supportInstanceIds
Derived support links rebuilt from authoritative level/address data.
Definition BuildingTypes.h:236
CornerAddress corner
Canonical grid vertex when placementKind is corner.
Definition BuildingTypes.h:199