Skip to content

Commit 96f58f2

Browse files
MacSplodySharlikran
authored andcommitted
Disable persistent cell import
1 parent 7268c14 commit 96f58f2

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
@@ -265,7 +265,7 @@ class CellImporter(_ACellImporter, ImportPatcher):
265265
def initPatchFile(self, patchFile):
266266
super(CellImporter, self).initPatchFile(patchFile)
267267
self.cellData = defaultdict(dict)
268-
self.persistentData = defaultdict(dict)
268+
# self.persistentData = defaultdict(dict)
269269
# TODO: docs: recAttrs vs tag_attrs - extra in PBash:
270270
# 'unused1','unused2','unused3'
271271
self.recAttrs = bush.game.cellRecAttrs # dict[unicode, tuple[str]]
@@ -283,7 +283,7 @@ def initData(self,progress):
283283
"""Get cells from source files."""
284284
if not self.isActive: return
285285
cellData = self.cellData
286-
persistentData = self.persistentData
286+
# persistentData = self.persistentData
287287
# cellData['Maps'] = {}
288288
def importCellBlockData(cellBlock):
289289
"""
@@ -294,14 +294,14 @@ def importCellBlockData(cellBlock):
294294
"""
295295
if not cellBlock.cell.flags1.ignored:
296296
fid = cellBlock.cell.fid
297-
if cellBlock.cell.flags1.persistent:
298-
for attr in attrs:
299-
tempPersistentData[fid][attr] = (
300-
cellBlock.cell.__getattribute__(attr))
301-
for flg_ in flgs_:
302-
tempPersistentData[fid + ('flags',)][flg_] = (
303-
cellBlock.cell.flags.__getattr__(flg_))
304-
else:
297+
# if cellBlock.cell.flags1.persistent:
298+
# for attr in attrs:
299+
# tempPersistentData[fid][attr] = (
300+
# cellBlock.cell.__getattribute__(attr))
301+
# for flg_ in flgs_:
302+
# tempPersistentData[fid + ('flags',)][flg_] = (
303+
# cellBlock.cell.flags.__getattr__(flg_))
304+
if not cellBlock.cell.flags1.persistent:
305305
for attr in attrs:
306306
tempCellData[fid][attr] = (
307307
cellBlock.cell.__getattribute__(attr))
@@ -319,18 +319,18 @@ def checkMasterCellBlockData(cellBlock):
319319
"""
320320
if not cellBlock.cell.flags1.ignored:
321321
fid = cellBlock.cell.fid
322-
if fid in tempPersistentData:
323-
for attr in attrs:
324-
master_attr = cellBlock.cell.__getattribute__(attr)
325-
if tempPersistentData[fid][attr] != master_attr:
326-
persistentData[fid][attr] = (
327-
tempPersistentData[fid][attr])
328-
for flg_ in flgs_:
329-
master_flag = cellBlock.cell.flags.__getattr__(flg_)
330-
if tempPersistentData[fid + ('flags',)][
331-
flg_] != master_flag:
332-
persistentData[fid + ('flags',)][flg_] = (
333-
tempPersistentData[fid + ('flags',)][flg_])
322+
# if fid in tempPersistentData:
323+
# for attr in attrs:
324+
# master_attr = cellBlock.cell.__getattribute__(attr)
325+
# if tempPersistentData[fid][attr] != master_attr:
326+
# persistentData[fid][attr] = (
327+
# tempPersistentData[fid][attr])
328+
# for flg_ in flgs_:
329+
# master_flag = cellBlock.cell.flags.__getattr__(flg_)
330+
# if tempPersistentData[fid + ('flags',)][
331+
# flg_] != master_flag:
332+
# persistentData[fid + ('flags',)][flg_] = (
333+
# tempPersistentData[fid + ('flags',)][flg_])
334334
if fid in tempCellData:
335335
for attr in attrs:
336336
master_attr = cellBlock.cell.__getattribute__(attr)
@@ -354,7 +354,7 @@ def checkMasterCellBlockData(cellBlock):
354354
# values from the value in any of srcMod's masters.
355355
tempCellData = defaultdict(dict)
356356
tempCellData['Maps'] = {} # unused !
357-
tempPersistentData = defaultdict(dict)
357+
# tempPersistentData = defaultdict(dict)
358358
srcInfo = bosh.modInfos[srcMod]
359359
srcFile = ModFile(srcInfo,loadFactory)
360360
srcFile.load(True)
@@ -377,8 +377,8 @@ def checkMasterCellBlockData(cellBlock):
377377
for worldBlock in srcFile.WRLD.worldBlocks:
378378
for cellBlock in worldBlock.cellBlocks:
379379
importCellBlockData(cellBlock)
380-
if worldBlock.worldCellBlock:
381-
importCellBlockData(worldBlock.worldCellBlock)
380+
# if worldBlock.worldCellBlock:
381+
# importCellBlockData(worldBlock.worldCellBlock)
382382
# if 'C.Maps' in bashTags:
383383
# if worldBlock.world.mapPath:
384384
# tempCellData['Maps'][worldBlock.world.fid] = worldBlock.world.mapPath
@@ -399,8 +399,8 @@ def checkMasterCellBlockData(cellBlock):
399399
for worldBlock in masterFile.WRLD.worldBlocks:
400400
for cellBlock in worldBlock.cellBlocks:
401401
checkMasterCellBlockData(cellBlock)
402-
if worldBlock.worldCellBlock:
403-
checkMasterCellBlockData(worldBlock.worldCellBlock)
402+
# if worldBlock.worldCellBlock:
403+
# checkMasterCellBlockData(worldBlock.worldCellBlock)
404404
# if worldBlock.world.fid in tempCellData['Maps']:
405405
# if worldBlock.world.mapPath != tempCellData['Maps'][worldBlock.world.fid]:
406406
# cellData['Maps'][worldBlock.world.fid] = tempCellData['Maps'][worldBlock.world.fid]
@@ -414,7 +414,7 @@ def scanModFile(self, modFile, progress): # scanModFile0
414414
'CELL' not in modFile.tops and 'WRLD' not in modFile.tops):
415415
return
416416
cellData = self.cellData
417-
persistentData = self.persistentData
417+
# persistentData = self.persistentData
418418
patchCells = self.patchFile.CELL
419419
patchWorlds = self.patchFile.WRLD
420420
modFile.convertToLongFids(('CELL','WRLD'))
@@ -426,14 +426,15 @@ def scanModFile(self, modFile, progress): # scanModFile0
426426
for worldBlock in modFile.WRLD.worldBlocks:
427427
for cellBlock in worldBlock.cellBlocks:
428428
if cellBlock.cell.fid in cellData:
429-
patchWorlds.setWorld(worldBlock.world,
430-
worldBlock.worldCellBlock)
429+
patchWorlds.setWorld(worldBlock.world)
430+
# patchWorlds.setWorld(worldBlock.world,
431+
# worldBlock.worldCellBlock)
431432
patchWorlds.id_worldBlocks[
432433
worldBlock.world.fid].setCell(cellBlock.cell)
433-
if worldBlock.worldCellBlock is not None:
434-
if worldBlock.worldCellBlock.cell.fid in persistentData:
435-
patchWorlds.setWorld(worldBlock.world,
436-
worldBlock.worldCellBlock)
434+
# if worldBlock.worldCellBlock is not None:
435+
# if worldBlock.worldCellBlock.cell.fid in persistentData:
436+
# patchWorlds.setWorld(worldBlock.world,
437+
# worldBlock.worldCellBlock)
437438
# if worldBlock.world.fid in cellData['Maps']:
438439
# patchWorlds.setWorld(worldBlock.world)
439440

@@ -452,22 +453,22 @@ def handlePatchCellBlock(patchCellBlock):
452453
"""
453454
modified = False
454455
fid = patchCellBlock.cell.fid
455-
if fid in persistentData:
456-
for attr, value in persistentData[fid].iteritems():
457-
if attr == 'regions':
458-
if set(value).difference(set(
459-
patchCellBlock.cell.__getattribute__(attr))):
460-
patchCellBlock.cell.__setattr__(attr, value)
461-
modified = True
462-
else:
463-
if patchCellBlock.cell.__getattribute__(attr) != value:
464-
patchCellBlock.cell.__setattr__(attr, value)
465-
modified = True
466-
for flag, value in persistentData[fid + ('flags',)].iteritems():
467-
if patchCellBlock.cell.flags.__getattr__(flag) != value:
468-
patchCellBlock.cell.flags.__setattr__(flag, value)
469-
modified = True
470-
elif fid in cellData:
456+
# if fid in persistentData:
457+
# for attr, value in persistentData[fid].iteritems():
458+
# if attr == 'regions':
459+
# if set(value).difference(set(
460+
# patchCellBlock.cell.__getattribute__(attr))):
461+
# patchCellBlock.cell.__setattr__(attr, value)
462+
# modified = True
463+
# else:
464+
# if patchCellBlock.cell.__getattribute__(attr) != value:
465+
# patchCellBlock.cell.__setattr__(attr, value)
466+
# modified = True
467+
# for flag, value in persistentData[fid + ('flags',)].iteritems():
468+
# if patchCellBlock.cell.flags.__getattr__(flag) != value:
469+
# patchCellBlock.cell.flags.__setattr__(flag, value)
470+
# modified = True
471+
if fid in cellData:
471472
for attr, value in cellData[fid].iteritems():
472473
if attr == 'regions':
473474
if set(value).difference(set(
@@ -489,23 +490,25 @@ def handlePatchCellBlock(patchCellBlock):
489490

490491
if not self.isActive: return
491492
keep = self.patchFile.getKeeper()
492-
cellData, persistentData, count = (
493-
self.cellData, self.persistentData, Counter())
493+
cellData, count = self.cellData, Counter()
494+
# cellData, persistentData, count = (
495+
# self.cellData, self.persistentData, Counter())
494496
for cellBlock in self.patchFile.CELL.cellBlocks:
495-
if cellBlock.cell.fid in cellData and handlePatchCellBlock(cellBlock):
496-
count[cellBlock.cell.fid[0]] += 1
497+
if cellBlock.cell.fid in cellData:
498+
if handlePatchCellBlock(cellBlock):
499+
count[cellBlock.cell.fid[0]] += 1
497500
for worldBlock in self.patchFile.WRLD.worldBlocks:
498501
keepWorld = False
499502
for cellBlock in worldBlock.cellBlocks:
500503
if cellBlock.cell.fid in cellData:
501504
if handlePatchCellBlock(cellBlock):
502505
count[cellBlock.cell.fid[0]] += 1
503506
keepWorld = True
504-
if worldBlock.worldCellBlock:
505-
if worldBlock.worldCellBlock.cell.fid in persistentData:
506-
if handlePatchCellBlock(worldBlock.worldCellBlock):
507-
count[worldBlock.worldCellBlock.cell.fid[0]] += 1
508-
keepWorld = True
507+
# if worldBlock.worldCellBlock:
508+
# if worldBlock.worldCellBlock.cell.fid in persistentData:
509+
# if handlePatchCellBlock(worldBlock.worldCellBlock):
510+
# count[worldBlock.worldCellBlock.cell.fid[0]] += 1
511+
# keepWorld = True
509512
# if worldBlock.world.fid in cellData['Maps']:
510513
# if worldBlock.world.mapPath != cellData['Maps'][worldBlock.world.fid]:
511514
# 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)