Skip to content

Commit 87ed32f

Browse files
InfernioSharlikran
authored andcommitted
Convert to long FormIDs before patching Stats
This _properly_ fixes the crashes and the ITMs caused by the 'Critical Effect' field of the CRDT subrecord of the WEAP record. The cause was that the record definitions define criticalEffect to be a FID, but to properly initialize FormIDs, convertToLongFids() must first be called. Otherwise, they remain as integers. Later on in the patch building process, we make a copy of each record from the source mods, to be included in the final BP, but this copy procedure (MreRecord.getTypeCopy, if you're curious) converts FormIDs when copying. This resulted in us having cached mod data where criticalEffect was an int, and a copy of that data where criticalEffect was a FormID. Long FormIDs are tuples of a string and an integer, while short FormIDs are just integers. Obviously, a comparison between the two will show them as different - causing the BP to think that _every_ record that occurs in a source mod had changes that needed to be preserved - hence the ITMs. I haven't figured out how this was responsible for the crashes, but I can confirm that they're fixed as of this commit. Supersedes 'Fix Duplicate Records In Stats Parsing' (73be14f).
1 parent 5d1649b commit 87ed32f

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Mopy/bash/parsers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,10 +1471,10 @@ def readFromMod(self,modInfo):
14711471
loadFactory = LoadFactory(False,*typeClasses)
14721472
modFile = ModFile(modInfo,loadFactory)
14731473
modFile.load(True)
1474-
mapper = modFile.getLongMapper()
1474+
modFile.convertToLongFids()
14751475
for group, attrs in self.class_attrs.iteritems():
14761476
for record in getattr(modFile,group).getActiveRecords():
1477-
self.class_fid_attr_value[group][mapper(record.fid)].update(
1477+
self.class_fid_attr_value[group][record.fid].update(
14781478
zip(attrs, map(record.__getattribute__, attrs)))
14791479

14801480
def writeToMod(self,modInfo):
@@ -1483,12 +1483,12 @@ def writeToMod(self,modInfo):
14831483
loadFactory = LoadFactory(True,*typeClasses)
14841484
modFile = ModFile(modInfo,loadFactory)
14851485
modFile.load(True)
1486-
mapper = modFile.getLongMapper()
1486+
modFile.convertToLongFids()
14871487
changed = defaultdict(int) #--changed[modName] = numChanged
14881488
for group, fid_attr_value in self.class_fid_attr_value.iteritems():
14891489
attrs = self.class_attrs[group]
14901490
for record in getattr(modFile,group).getActiveRecords():
1491-
longid = mapper(record.fid)
1491+
longid = record.fid
14921492
itemStats = fid_attr_value.get(longid,None)
14931493
if not itemStats: continue
14941494
oldValues = dict(zip(attrs,map(record.__getattribute__,attrs)))

0 commit comments

Comments
 (0)