update code to use new config class
This commit is contained in:
+4
-4
@@ -1,16 +1,16 @@
|
|||||||
import my_helpers.myPickle as my_pickle
|
import my_helpers.myPickle as my_pickle
|
||||||
|
from my_helpers.Config import Config
|
||||||
from classes.Map import Map
|
from classes.Map import Map
|
||||||
|
|
||||||
from json import load as json_load
|
import lzma, os
|
||||||
import lzma
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
with open("config.json", "r") as f:
|
CONFIG = Config("config.json")
|
||||||
CONFIG = json_load(f)
|
|
||||||
|
|
||||||
game_map = Map("./Map")
|
game_map = Map("./Map")
|
||||||
game_map.make_file()
|
game_map.make_file()
|
||||||
|
|
||||||
|
os.makedirs(CONFIG['map_file']['path'], exist_ok=True)
|
||||||
with open(f"{CONFIG['map_file']['path']}/{CONFIG['map_file']['filename']}", "wb") as f:
|
with open(f"{CONFIG['map_file']['path']}/{CONFIG['map_file']['filename']}", "wb") as f:
|
||||||
my_pickle.dump(game_map, f, lzma)
|
my_pickle.dump(game_map, f, lzma)
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
from classes.GameBoard import GameBoard
|
from classes.GameBoard import GameBoard
|
||||||
|
from my_helpers.Config import Config
|
||||||
|
|
||||||
from json import load as json_load
|
|
||||||
import logging
|
import logging
|
||||||
import lzma, os
|
import lzma, os
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
with open("config.json", "r") as f:
|
CONFIG = Config("config.json")
|
||||||
CONFIG = json_load(f)
|
|
||||||
|
|
||||||
if CONFIG["logging"]["enabled"]:
|
if CONFIG["logging"]["enabled"]:
|
||||||
os.makedirs(CONFIG['logging']['file']['path'], exist_ok=True)
|
os.makedirs(CONFIG['logging']['file']['path'], exist_ok=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user