From f8776de50325d141aaa70957052beff11e24a3df Mon Sep 17 00:00:00 2001 From: Jylpah Date: Wed, 30 Jan 2019 21:49:56 +0200 Subject: [PATCH] Fixing a bug related to reading map data form maps.json --- blitzutils.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/blitzutils.py b/blitzutils.py index 46e6c43..816d553 100644 --- a/blitzutils.py +++ b/blitzutils.py @@ -269,7 +269,7 @@ class WG: self.WG_appID = WG_appID self.tanks = None - + if (tankopedia_fn != None): if os.path.exists(tankopedia_fn) and os.path.isfile(tankopedia_fn): try: @@ -283,7 +283,7 @@ class WG: if os.path.exists(maps_fn) and os.path.isfile(maps_fn): try: with open(maps_fn, 'rt', encoding='utf8') as f: - self.maps = json.loads(f.read()) + WG.maps = json.loads(f.read()) except Exception as err: error('Could not read maps file: ' + maps_fn + '\n' + str(err)) else: @@ -337,6 +337,12 @@ class WG: return 'eu' return None + @classmethod + def updateMaps(cls, mapdata: dict): + """Update maps data""" + cls.maps = mapdata + return None + @classmethod def getMap(cls, mapStr: str) -> str: """Return map name from short map string in replays"""