Skip to content

Commit 099c09d

Browse files
committed
FFF chopping off type occurences untested
1 parent a12db5d commit 099c09d

2 files changed

Lines changed: 15 additions & 13 deletions

File tree

Mopy/bash/basher/saves_links.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -812,17 +812,20 @@ def Execute(self):
812812
if not createdCounts and not nullRefCount:
813813
self._showOk(_(u'No bloating found.'), self._selected_item.s)
814814
return
815-
message = u''
815+
message = [_(u'Remove savegame bloating?')]
816816
if createdCounts:
817-
for type,name in sorted(createdCounts):
818-
message += u' %s %s: %s\n' % (type,name,formatInteger(createdCounts[(type,name)]))
817+
for created_item_rec_type, name in sorted(createdCounts):
818+
count_ = createdCounts[(created_item_rec_type, name)]
819+
message.append(u' %s %s: %s' % (
820+
created_item_rec_type, name, formatInteger(count_)))
819821
if nullRefCount:
820-
message += u' '+_(u'Null Ref Objects:')+ u' %s\n' % formatInteger(nullRefCount)
821-
message = (_(u'Remove savegame bloating?')
822-
+ u'\n'+message+u'\n' +
823-
_(u'WARNING: This is a risky procedure that may corrupt your savegame! Use only if necessary!')
824-
)
825-
if not self._askYes(message, _(u'Remove bloating?')): return
822+
message.append(u' ' + _(u'Null Ref Objects:') +
823+
u' %s' % formatInteger(nullRefCount))
824+
message.extend([u'', _(
825+
u'WARNING: This is a risky procedure that may corrupt your '
826+
u'savegame! Use only if necessary!')])
827+
if not self._askYes(u'\n'.join(message), _(u'Remove bloating?')):
828+
return
826829
#--Remove bloating
827830
with balt.Progress(_(u'Removing Bloat')) as progress:
828831
nums = saveFile.removeBloating(createdCounts.keys(),True,SubProgress(progress,0,0.9))

Mopy/bash/bosh/_saves.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
Oblivion only . We need this split into cosaves and proper saves module and
2626
coded for rest of the games."""
2727
# TODO: Oblivion only - we need to support rest of games - help needed
28+
from collections import Counter
2829
from itertools import starmap, repeat
2930
from operator import attrgetter
3031

@@ -610,7 +611,7 @@ def getMaster(modIndex):
610611
def findBloating(self,progress=None):
611612
"""Analyzes file for bloating. Returns (createdCounts,nullRefCount)."""
612613
nullRefCount = 0
613-
createdCounts = {}
614+
createdCounts = Counter()
614615
progress = progress or bolt.Progress()
615616
progress.setFull(len(self.created)+len(self.records))
616617
#--Created objects
@@ -622,9 +623,7 @@ def findBloating(self,progress=None):
622623
else:
623624
full = citem.getSubString('FULL')
624625
if full:
625-
typeFull = (citem.recType,full)
626-
count = createdCounts.get(typeFull,0)
627-
createdCounts[typeFull] = count + 1
626+
createdCounts[(citem.recType, full)] += 1
628627
progress.plus()
629628
for key in createdCounts.keys()[:]:
630629
minCount = (50,100)[key[0] == 'ALCH']

0 commit comments

Comments
 (0)