Skip to content

Commit c9cebea

Browse files
committed
Load map information before loading settings.
It is important to load map information as early as possible so that we can use the map name to help debug issues as they come up.
1 parent db032b0 commit c9cebea

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

sc2reader/resources.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,7 @@ def __init__(self, summary_file, filename=None, **options):
719719
self.start_time = datetime.utcfromtimestamp(self.parts[0][8] - self.real_length.seconds)
720720

721721
self.load_translations()
722+
self.load_map_info()
722723
self.load_settings()
723724
self.load_player_stats()
724725
self.load_player_builds()
@@ -727,11 +728,6 @@ def __init__(self, summary_file, filename=None, **options):
727728
self.game_type = self.settings['Teams'].replace(" ","")
728729
self.real_type = real_type(self.teams.values())
729730

730-
map_strings = self.lang_sheets['enUS'][-1]
731-
self.map_name = map_strings[1]
732-
self.map_description = map_strings[2]
733-
self.map_tileset = map_strings[3]
734-
735731
# The s2gs file also keeps reference to a series of s2mv files
736732
# Some of these appear to be encoded bytes and others appear to be
737733
# the preview images that authors may bundle with their maps.
@@ -809,6 +805,12 @@ def load_translations(self):
809805
self.lang_sheets[lang] = sheets
810806
self.translations[lang] = translation
811807

808+
def load_map_info(self):
809+
map_strings = self.lang_sheets['enUS'][-1]
810+
self.map_name = map_strings[1]
811+
self.map_description = map_strings[2]
812+
self.map_tileset = map_strings[3]
813+
812814
def load_settings(self):
813815
Property = namedtuple('Property',['id','values','requirements','defaults','is_lobby'])
814816

0 commit comments

Comments
 (0)