Skip to content

Commit

Permalink
use resolved map id
Browse files Browse the repository at this point in the history
  • Loading branch information
happyleavesaoc committed Oct 2, 2022
1 parent b289cb6 commit b344420
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion mgz/common/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,9 @@ def lookup_name(map_id, name, version, reference):
is_de = version == Version.DE
is_hd = version == Version.HD
# 59: RM custom
# 137: custom map pool
# 138: DM custom
if (map_id != 44 and not (is_de or is_hd)) or (map_id not in [59, 138] and (is_de or is_hd)):
if (map_id != 44 and not (is_de or is_hd)) or (map_id not in [59, 137, 138] and (is_de or is_hd)):
map_keys = [int(k) for k in reference['maps'].keys()]
if map_id in map_keys:
name = reference['maps'][str(map_id)]
Expand Down Expand Up @@ -174,6 +175,8 @@ def get_water_percent(tiles, dataset_id):
def get_mod_id(strings):
"""Extract RMS mod id."""
for obj in strings:
if not obj.string:
continue
s = obj.string.value.decode('utf-8').split(':')
if s[0] == 'SUBSCRIBEDMODS' and s[1] == 'RANDOM_MAPS':
return s[3].split('_')[0]
Expand Down
2 changes: 1 addition & 1 deletion mgz/summary/full.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ def get_map_id(self):
if self._header.hd:
return self._header.hd.selected_map_id
if self._header.de:
return self._header.de.selected_map_id
return self._header.de.resolved_map_id
return self._header.scenario.game_settings.map_id

def get_map(self):
Expand Down

0 comments on commit b344420

Please sign in to comment.