载入中...
搜索中...
未找到
PlacementSystem.h
浏览该文件的文档.
Definition Ghost.h:13
std::function< bool(const PlacementWorld &world, const PlacementQuery &q, std::string *reason)> ValidateFn
Definition PlacementSystem.h:22
static SnapResult snap(const PlacementWorld &world, const std::string &buildingId, float worldX, float worldY)
Definition PlacementSystem.cpp:261
static void effectiveFootprint(const BuildingDefinition &def, float rotationDeg, int *outW, int *outH)
旋转后的占地宽高(cardinal 90/270 交换)。
Definition PlacementSystem.cpp:300
static int placeAt(PlacementWorld *world, const std::string &buildingId, int cellX, int cellY, float rotationDeg=0.f)
成功返回 instanceId;失败返回 0。
Definition PlacementSystem.cpp:520
std::function< bool(const PlacementWorld &world, float x, float y, PlacementHit *hit)> SurfaceFn
Definition PlacementSystem.h:40
static std::vector< std::string > surfaceNames()
Definition PlacementSystem.cpp:120
static void registerSurface(const std::string &name, SurfaceFn fn)
Definition PlacementSystem.cpp:99
static int placeAtWorld3D(PlacementWorld *world, const std::string &buildingId, float worldX, float worldY, float worldZ, float rotationDeg=0.f)
Definition PlacementSystem.cpp:576
static SnapResult snap3D(const PlacementWorld &world, const std::string &buildingId, float worldX, float worldY, float worldZ)
Definition PlacementSystem.cpp:271
static PlacementSystem & inst()
Process singleton holding all PlacementSystem state.
Definition PlacementSystem.cpp:29
static const std::vector< BuildingChangeEvent > & events()
Definition PlacementSystem.cpp:235
static bool surfaceHit(const PlacementWorld &world, const std::string &name, float x, float y, PlacementHit *hit)
Definition PlacementSystem.cpp:111
static void clearBuildings(PlacementWorld *world)
Definition PlacementSystem.cpp:676
std::function< SnapResult(const PlacementWorld &world, float worldX, float worldY)> SnapFn
Definition PlacementSystem.h:24
static float getPlaneSurfaceHeight()
Definition PlacementSystem.cpp:130
static void unregisterChangeHook(const std::string &name)
Definition PlacementSystem.cpp:93
static void setPlaneSurfaceHeight(float h)
Definition PlacementSystem.cpp:128
static bool hasSurface(const std::string &name)
Definition PlacementSystem.cpp:106
std::function< void(const BuildingChangeEvent &ev)> ChangeHook
Definition PlacementSystem.h:25
static void pushEvent(BuildingChangeEvent ev)
Definition PlacementSystem.cpp:226
static bool foreachFootprintCell(const BuildingDefinition &def, int originCellX, int originCellY, float rotationDeg, const std::function< bool(int cx, int cy)> &fn)
枚举占地格子(旋转后局部 → 世界格子)。返回 false 若定义未知。
Definition PlacementSystem.cpp:316
static float normalizeRotation(const std::string &buildingId, float rotationDeg)
规范化旋转角(cardinal → 0/90/180/270;none → 0)。
Definition PlacementSystem.cpp:286
static bool removeBuilding(PlacementWorld *world, int instanceId)
Definition PlacementSystem.cpp:609
static bool hasSnapRule(const std::string &name)
Definition PlacementSystem.cpp:83
static void clearEvents()
Definition PlacementSystem.cpp:233
static void unregisterSurface(const std::string &name)
Definition PlacementSystem.cpp:104
static bool moveBuilding(PlacementWorld *world, int instanceId, int cellX, int cellY, float rotationDeg=-1.f)
Definition PlacementSystem.cpp:635
static bool hasChangeHook(const std::string &name)
Definition PlacementSystem.cpp:95
static int placeAtWorld(PlacementWorld *world, const std::string &buildingId, float worldX, float worldY, float rotationDeg=0.f)
先吸附再放置;free/自定义 snap 会保留吸附后的世界坐标。
Definition PlacementSystem.cpp:560
static void registerSnapRule(const std::string &name, SnapFn fn)
Definition PlacementSystem.cpp:76
static bool hasValidateRule(const std::string &name)
Definition PlacementSystem.cpp:71
static int placeGhost(PlacementWorld *world, Ghost *ghost)
Definition PlacementSystem.cpp:593
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)
Definition PlacementSystem.cpp:463
static void pollEvents(std::vector< BuildingChangeEvent > &out)
Definition PlacementSystem.cpp:228
static void unregisterValidateRule(const std::string &name)
Definition PlacementSystem.cpp:67
static int nextInstanceId()
Definition PlacementSystem.cpp:224
static void unregisterSnapRule(const std::string &name)
Definition PlacementSystem.cpp:81
static bool canPlace(PlacementWorld *world, const std::string &buildingId, int cellX, int cellY, float rotationDeg=0.f, int excludeInstanceId=0, std::string *reason=nullptr)
Definition PlacementSystem.cpp:487
static void registerChangeHook(const std::string &name, ChangeHook fn)
Definition PlacementSystem.cpp:88
static SnapResult snapWithMode(const PlacementWorld &world, const std::string &mode, float worldX, float worldY)
Definition PlacementSystem.cpp:244
static void registerValidateRule(const std::string &name, ValidateFn fn)
Definition PlacementSystem.cpp:62
建筑放置模块入口:定义 / 放置世界 / 鬼影 / 变更事件的脚本绑定点。 设计文档:docs/dev/建筑放置系统设计.md
Definition Building.cpp:7