外观
Province / Tile Owner 平行数组
状态:Authoritative Reference v1
1. 物理结构
Terrain 后不是一组交错 Tile record,而是两个独立平行数组:
text
Province slots H58 * 0x02
Tile owner slots H58 * 0x01其中 H58 = AlignedTileSlotCount。
当前 1358/1358 原版 BTL:
text
H58 == align_up(MapWidth * MapHeight, 8)只有前 MapWidth * MapHeight 个 slot 是真实逻辑 Tile;尾部对齐 slot 不是额外地图格。
2. Province slot
每个 Province slot:
text
+0x00 int16 AnchorTileIdRaw当前安全解释:
text
AnchorTileIdRaw < 0 -> no province
AnchorTileIdRaw >= 0 -> 该 Tile 归属于以该 anchor TileId 标识的 Province原版构造会按该值解析/创建 Province,再建立 Tile <-> Province 关系。
因此它不是 province 数组 index,也不是简单 province ordinal。
3. Tile owner slot
每个 owner slot:
text
+0x00 int8 CountryIndexRaw当前安全解释:
text
CountryIndexRaw < 0 -> ownerless Tile
CountryIndexRaw >= 0 -> BTL Country section 数组位置这里确实使用 BtlCountryIndex,与 Event/Strategy/Reinforcement 中常见的 CountryRecordId 域不同。
原版构造:
text
owner index
-> Country array
-> Tile.Country pointer
-> append Tile to Country owned-Tile collection4. Padding slot
因为 H58 做 8-slot 对齐,末尾可能存在 padding。工具必须用逻辑地图尺寸区分:
text
logical slot: index < MapWidth * MapHeight
padding slot: index >= MapWidth * MapHeight && index < H58不能把 padding slot 作为可编辑地图 Tile 暴露给用户。
5. Writer 边界
Province 与 owner scalar 的读取身份已 Confirmed,但修改会影响:
- Province membership;
- Country owned-Tile collection;
- 战局胜负/占领等后续规则;
- 引用和地图不变量。
因此 Reference 本身不授权 writer;必须服从专门的地图/省域/owner 写入门禁。
主要证据:
text
reconstruction/src/WC4.Runtime.BattleData/BtlMapRecords.cs
reconstruction/docs/route4_round2_raw_views.md
reports/btl_v1280_so_recovery.md