Skip to content

Commit 298f8b4

Browse files
committed
Disable persistent cell import
1 parent 7a08257 commit 298f8b4

2 files changed

Lines changed: 65 additions & 61 deletions

File tree

Mopy/bash/patcher/patchers/importers.py

Lines changed: 62 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ class CellImporter(_ACellImporter, ImportPatcher):
261261
def initPatchFile(self, patchFile):
262262
super(CellImporter, self).initPatchFile(patchFile)
263263
self.cellData = defaultdict(dict)
264-
self.persistentData = defaultdict(dict)
264+
# self.persistentData = defaultdict(dict)
265265
# TODO: docs: recAttrs vs tag_attrs - extra in PBash:
266266
# 'unused1','unused2','unused3'
267267
self.recAttrs = bush.game.cellRecAttrs # dict[unicode, tuple[str]]
@@ -279,7 +279,7 @@ def initData(self,progress):
279279
"""Get cells from source files."""
280280
if not self.isActive: return
281281
cellData = self.cellData
282-
persistentData = self.persistentData
282+
# persistentData = self.persistentData
283283
# cellData['Maps'] = {}
284284
def importCellBlockData(cellBlock):
285285
"""
@@ -290,14 +290,14 @@ def importCellBlockData(cellBlock):
290290
"""
291291
if not cellBlock.cell.flags1.ignored:
292292
fid = cellBlock.cell.fid
293-
if cellBlock.cell.flags1.persistent:
294-
for attr in attrs:
295-
tempPersistentData[fid][attr] = (
296-
cellBlock.cell.__getattribute__(attr))
297-
for flg_ in flgs_:
298-
tempPersistentData[fid + ('flags',)][flg_] = (
299-
cellBlock.cell.flags.__getattr__(flg_))
300-
else:
293+
# if cellBlock.cell.flags1.persistent:
294+
# for attr in attrs:
295+
# tempPersistentData[fid][attr] = (
296+
# cellBlock.cell.__getattribute__(attr))
297+
# for flg_ in flgs_:
298+
# tempPersistentData[fid + ('flags',)][flg_] = (
299+
# cellBlock.cell.flags.__getattr__(flg_))
300+
if not cellBlock.cell.flags1.persistent:
301301
for attr in attrs:
302302
tempCellData[fid][attr] = (
303303
cellBlock.cell.__getattribute__(attr))
@@ -315,18 +315,18 @@ def checkMasterCellBlockData(cellBlock):
315315
"""
316316
if not cellBlock.cell.flags1.ignored:
317317
fid = cellBlock.cell.fid
318-
if fid in tempPersistentData:
319-
for attr in attrs:
320-
master_attr = cellBlock.cell.__getattribute__(attr)
321-
if tempPersistentData[fid][attr] != master_attr:
322-
persistentData[fid][attr] = (
323-
tempPersistentData[fid][attr])
324-
for flg_ in flgs_:
325-
master_flag = cellBlock.cell.flags.__getattr__(flg_)
326-
if tempPersistentData[fid + ('flags',)][
327-
flg_] != master_flag:
328-
persistentData[fid + ('flags',)][flg_] = (
329-
tempPersistentData[fid + ('flags',)][flg_])
318+
# if fid in tempPersistentData:
319+
# for attr in attrs:
320+
# master_attr = cellBlock.cell.__getattribute__(attr)
321+
# if tempPersistentData[fid][attr] != master_attr:
322+
# persistentData[fid][attr] = (
323+
# tempPersistentData[fid][attr])
324+
# for flg_ in flgs_:
325+
# master_flag = cellBlock.cell.flags.__getattr__(flg_)
326+
# if tempPersistentData[fid + ('flags',)][
327+
# flg_] != master_flag:
328+
# persistentData[fid + ('flags',)][flg_] = (
329+
# tempPersistentData[fid + ('flags',)][flg_])
330330
if fid in tempCellData:
331331
for attr in attrs:
332332
master_attr = cellBlock.cell.__getattribute__(attr)
@@ -350,7 +350,7 @@ def checkMasterCellBlockData(cellBlock):
350350
# values from the value in any of srcMod's masters.
351351
tempCellData = defaultdict(dict)
352352
tempCellData['Maps'] = {} # unused !
353-
tempPersistentData = defaultdict(dict)
353+
# tempPersistentData = defaultdict(dict)
354354
srcInfo = bosh.modInfos[srcMod]
355355
srcFile = ModFile(srcInfo,loadFactory)
356356
srcFile.load(True)
@@ -373,8 +373,8 @@ def checkMasterCellBlockData(cellBlock):
373373
for worldBlock in srcFile.WRLD.worldBlocks:
374374
for cellBlock in worldBlock.cellBlocks:
375375
importCellBlockData(cellBlock)
376-
if worldBlock.worldCellBlock:
377-
importCellBlockData(worldBlock.worldCellBlock)
376+
# if worldBlock.worldCellBlock:
377+
# importCellBlockData(worldBlock.worldCellBlock)
378378
# if 'C.Maps' in bashTags:
379379
# if worldBlock.world.mapPath:
380380
# tempCellData['Maps'][worldBlock.world.fid] = worldBlock.world.mapPath
@@ -395,8 +395,8 @@ def checkMasterCellBlockData(cellBlock):
395395
for worldBlock in masterFile.WRLD.worldBlocks:
396396
for cellBlock in worldBlock.cellBlocks:
397397
checkMasterCellBlockData(cellBlock)
398-
if worldBlock.worldCellBlock:
399-
checkMasterCellBlockData(worldBlock.worldCellBlock)
398+
# if worldBlock.worldCellBlock:
399+
# checkMasterCellBlockData(worldBlock.worldCellBlock)
400400
# if worldBlock.world.fid in tempCellData['Maps']:
401401
# if worldBlock.world.mapPath != tempCellData['Maps'][worldBlock.world.fid]:
402402
# cellData['Maps'][worldBlock.world.fid] = tempCellData['Maps'][worldBlock.world.fid]
@@ -410,7 +410,7 @@ def scanModFile(self, modFile, progress): # scanModFile0
410410
'CELL' not in modFile.tops and 'WRLD' not in modFile.tops):
411411
return
412412
cellData = self.cellData
413-
persistentData = self.persistentData
413+
# persistentData = self.persistentData
414414
patchCells = self.patchFile.CELL
415415
patchWorlds = self.patchFile.WRLD
416416
modFile.convertToLongFids(('CELL','WRLD'))
@@ -422,14 +422,15 @@ def scanModFile(self, modFile, progress): # scanModFile0
422422
for worldBlock in modFile.WRLD.worldBlocks:
423423
for cellBlock in worldBlock.cellBlocks:
424424
if cellBlock.cell.fid in cellData:
425-
patchWorlds.setWorld(worldBlock.world,
426-
worldBlock.worldCellBlock)
425+
patchWorlds.setWorld(worldBlock.world)
426+
# patchWorlds.setWorld(worldBlock.world,
427+
# worldBlock.worldCellBlock)
427428
patchWorlds.id_worldBlocks[
428429
worldBlock.world.fid].setCell(cellBlock.cell)
429-
if worldBlock.worldCellBlock is not None:
430-
if worldBlock.worldCellBlock.cell.fid in persistentData:
431-
patchWorlds.setWorld(worldBlock.world,
432-
worldBlock.worldCellBlock)
430+
# if worldBlock.worldCellBlock is not None:
431+
# if worldBlock.worldCellBlock.cell.fid in persistentData:
432+
# patchWorlds.setWorld(worldBlock.world,
433+
# worldBlock.worldCellBlock)
433434
# if worldBlock.world.fid in cellData['Maps']:
434435
# patchWorlds.setWorld(worldBlock.world)
435436

@@ -448,22 +449,22 @@ def handlePatchCellBlock(patchCellBlock):
448449
"""
449450
modified = False
450451
fid = patchCellBlock.cell.fid
451-
if fid in persistentData:
452-
for attr, value in persistentData[fid].iteritems():
453-
if attr == 'regions':
454-
if set(value).difference(set(
455-
patchCellBlock.cell.__getattribute__(attr))):
456-
patchCellBlock.cell.__setattr__(attr, value)
457-
modified = True
458-
else:
459-
if patchCellBlock.cell.__getattribute__(attr) != value:
460-
patchCellBlock.cell.__setattr__(attr, value)
461-
modified = True
462-
for flag, value in persistentData[fid + ('flags',)].iteritems():
463-
if patchCellBlock.cell.flags.__getattr__(flag) != value:
464-
patchCellBlock.cell.flags.__setattr__(flag, value)
465-
modified = True
466-
elif fid in cellData:
452+
# if fid in persistentData:
453+
# for attr, value in persistentData[fid].iteritems():
454+
# if attr == 'regions':
455+
# if set(value).difference(set(
456+
# patchCellBlock.cell.__getattribute__(attr))):
457+
# patchCellBlock.cell.__setattr__(attr, value)
458+
# modified = True
459+
# else:
460+
# if patchCellBlock.cell.__getattribute__(attr) != value:
461+
# patchCellBlock.cell.__setattr__(attr, value)
462+
# modified = True
463+
# for flag, value in persistentData[fid + ('flags',)].iteritems():
464+
# if patchCellBlock.cell.flags.__getattr__(flag) != value:
465+
# patchCellBlock.cell.flags.__setattr__(flag, value)
466+
# modified = True
467+
if fid in cellData:
467468
for attr, value in cellData[fid].iteritems():
468469
if attr == 'regions':
469470
if set(value).difference(set(
@@ -485,23 +486,25 @@ def handlePatchCellBlock(patchCellBlock):
485486

486487
if not self.isActive: return
487488
keep = self.patchFile.getKeeper()
488-
cellData, persistentData, count = (
489-
self.cellData, self.persistentData, Counter())
489+
cellData, count = self.cellData, Counter()
490+
# cellData, persistentData, count = (
491+
# self.cellData, self.persistentData, Counter())
490492
for cellBlock in self.patchFile.CELL.cellBlocks:
491-
if cellBlock.cell.fid in cellData and handlePatchCellBlock(cellBlock):
492-
count[cellBlock.cell.fid[0]] += 1
493+
if cellBlock.cell.fid in cellData:
494+
if handlePatchCellBlock(cellBlock):
495+
count[cellBlock.cell.fid[0]] += 1
493496
for worldBlock in self.patchFile.WRLD.worldBlocks:
494497
keepWorld = False
495498
for cellBlock in worldBlock.cellBlocks:
496499
if cellBlock.cell.fid in cellData:
497500
if handlePatchCellBlock(cellBlock):
498501
count[cellBlock.cell.fid[0]] += 1
499502
keepWorld = True
500-
if worldBlock.worldCellBlock:
501-
if worldBlock.worldCellBlock.cell.fid in persistentData:
502-
if handlePatchCellBlock(worldBlock.worldCellBlock):
503-
count[worldBlock.worldCellBlock.cell.fid[0]] += 1
504-
keepWorld = True
503+
# if worldBlock.worldCellBlock:
504+
# if worldBlock.worldCellBlock.cell.fid in persistentData:
505+
# if handlePatchCellBlock(worldBlock.worldCellBlock):
506+
# count[worldBlock.worldCellBlock.cell.fid[0]] += 1
507+
# keepWorld = True
505508
# if worldBlock.world.fid in cellData['Maps']:
506509
# if worldBlock.world.mapPath != cellData['Maps'][worldBlock.world.fid]:
507510
# print worldBlock.world.mapPath

Mopy/bash/record_groups.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,14 +1122,15 @@ def updateRecords(self,srcBlock,mapper,mergeIds):
11221122
if worldBlock:
11231123
worldBlock.updateRecords(srcWorldBlock,mapper,mergeIds)
11241124

1125-
def setWorld(self, world, worldcellblock=None):
1125+
# def setWorld(self, world, worldcellblock=None):
1126+
def setWorld(self, world):
11261127
"""Adds record to record list and indexed."""
11271128
if self.worldBlocks and not self.id_worldBlocks:
11281129
self.indexRecords()
11291130
fid = world.fid
11301131
if fid in self.id_worldBlocks:
11311132
self.id_worldBlocks[fid].world = world
1132-
self.id_worldBlocks[fid].worldCellBlock = worldcellblock
1133+
# self.id_worldBlocks[fid].worldCellBlock = worldcellblock
11331134
else:
11341135
worldBlock = MobWorld(RecordHeader('GRUP',0,0,1,self.stamp),
11351136
self.loadFactory,world)

0 commit comments

Comments
 (0)