Skip to content

Commit a42ca59

Browse files
committed
Fix duplicate name when same block used twice in one town
Potential fix for #2237. This code was removed by #2100. However, it's necessary to edit then store a *copy* of block data for each block to have a unique name seed from MAPS.BSA, even when starting from same RMB data. If data is modified in same instance of RMB data then second time block data is read it effectively overwrites first. @df-ferital Please let me know if this causes any problems with your RMB caching. I'm not sure why this removed and I didn't catch this outcome in my review of your RMB caching PR. Thank you! :)
1 parent db0e63a commit a42ca59

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Assets/Scripts/Utility/RMBLayout.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,11 @@ public static DFBlock[] GetLocationBuildingData(in DFLocation location)
643643
if (!contentReader.GetBlock(blockName, out block))
644644
throw new Exception("GetCompleteBuildingData() could not read block " + blockName);
645645

646+
// Make a copy of the building data array for our block copy since we're modifying it
647+
DFLocation.BuildingData[] buildingArray = new DFLocation.BuildingData[block.RmbBlock.FldHeader.BuildingDataList.Length];
648+
Array.Copy(block.RmbBlock.FldHeader.BuildingDataList, buildingArray, block.RmbBlock.FldHeader.BuildingDataList.Length);
649+
block.RmbBlock.FldHeader.BuildingDataList = buildingArray;
650+
646651
// Assign building data for this block
647652
BuildingReplacementData buildingReplacementData;
648653
for (int i = 0; i < block.RmbBlock.SubRecords.Length; i++)

0 commit comments

Comments
 (0)