Fixing a bug related to reading map data form maps.json

This commit is contained in:
Jylpah committed 2019-01-30 21:49:56 +02:00
1 parent 05bc831355
commit f8776de503
1 file changed
+8 -2
+8 -2
View File
@@ -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"""