mirror of
https://github.com/shlomif/PySolFC.git
synced 2025-04-05 00:02:29 -04:00
Extract a function or class to step away from God Object.
See: * https://en.wikipedia.org/wiki/God_object * https://www.c-sharpcorner.com/article/god-object-a-code-smell/ . This is Refactoring / code cleanup. See: * https://refactoring.com/catalog/extractMethod.html * https://en.wikipedia.org/wiki/Code_refactoring * https://www.refactoring.com/ * https://www.joelonsoftware.com/2002/01/23/rub-a-dub-dub/ Some small optimisations may have slipped in as well.
This commit is contained in:
parent
b250a567ae
commit
fab74e9a4b
1 changed files with 8 additions and 5 deletions
|
@ -458,6 +458,13 @@ class GameLoadInfo(NewStruct):
|
|||
talon_round = attr.ib(default=1)
|
||||
|
||||
|
||||
# global saveinfo survives a game restart
|
||||
@attr.s
|
||||
class GameGlobalSaveInfo(NewStruct):
|
||||
bookmarks = attr.ib(factory=dict)
|
||||
comment = attr.ib(default="")
|
||||
|
||||
|
||||
class Game(object):
|
||||
# for self.gstats.updated
|
||||
U_PLAY = _GLOBAL_U_PLAY
|
||||
|
@ -716,11 +723,7 @@ class Game(object):
|
|||
return
|
||||
# global statistics survive a game restart
|
||||
self.gstats = GameGlobalStatsStruct()
|
||||
# global saveinfo survives a game restart
|
||||
self.gsaveinfo = Struct(
|
||||
bookmarks={},
|
||||
comment="",
|
||||
)
|
||||
self.gsaveinfo = GameGlobalSaveInfo()
|
||||
# some vars for win animation
|
||||
self.win_animation = GameWinAnimation()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue