Skip to content

Commit a7c7a6b

Browse files
UtumnoSharlikran
authored andcommitted
Some dup code editing in game.py FFF
fix warn mutable default
1 parent e335f3d commit a7c7a6b

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

Mopy/bash/games.py

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def _write_plugins_txt_(path, lord, active, _star):
4848
__write_plugins(out, lord, active, _star)
4949

5050
def __write_plugins(out, lord, active, _star):
51-
def asterisk(active_set=set(active)):
51+
def asterisk(active_set=frozenset(active)):
5252
return '*' if _star and (mod in active_set) else ''
5353
for mod in (_star and lord) or active:
5454
# Ok, this seems to work for Oblivion, but not Skyrim
@@ -189,6 +189,7 @@ class Game(object):
189189
must_be_active_if_present = ()
190190
max_espms = 255
191191
max_esls = 0
192+
_star = False # whether plugins.txt uses a star to denote an active plugin
192193

193194
def __init__(self, mod_infos, plugins_txt_path):
194195
super(Game, self).__init__()
@@ -350,11 +351,11 @@ def _parse_modfile(self, path):
350351
""":rtype: (list[bolt.Path], list[bolt.Path])"""
351352
if not path.exists(): return [], []
352353
#--Read file
353-
acti, _lo = _parse_plugins_txt_(path, self.mod_infos, _star=False)
354+
acti, _lo = _parse_plugins_txt_(path, self.mod_infos, _star=self._star)
354355
return acti, _lo
355356

356357
def _write_modfile(self, path, lord, active):
357-
_write_plugins_txt_(path, lord, active, _star=False)
358+
_write_plugins_txt_(path, lord, active, _star=self._star)
358359

359360
# PLUGINS TXT -------------------------------------------------------------
360361
def _parse_plugins_txt(self):
@@ -741,6 +742,7 @@ class AsteriskGame(Game):
741742
max_espms = 254
742743
max_esls = 4096 # hard limit, game runs out of fds sooner, testing needed
743744
_ccc_filename = u''
745+
_star = True
744746

745747
@property
746748
def remove_from_plugins_txt(self): return set()
@@ -803,15 +805,6 @@ def _persist_if_changed(self, active, lord, previous_active,
803805
previous_active is None or previous_active != active):
804806
self._persist_load_order(lord, active)
805807

806-
# Modfiles parsing overrides ----------------------------------------------
807-
def _parse_modfile(self, path):
808-
if not path.exists(): return [], []
809-
acti, lo = _parse_plugins_txt_(path, self.mod_infos, _star=True)
810-
return acti, lo
811-
812-
def _write_modfile(self, path, lord, active):
813-
_write_plugins_txt_(path, lord, active, _star=True)
814-
815808
# Validation overrides ----------------------------------------------------
816809
def _order_fixed(self, lord):
817810
lo = [x for x in lord if x not in self.remove_from_plugins_txt]

0 commit comments

Comments
 (0)