# Path: magnate/errors.py
# class MagnateNoSaveGame(MagnateSaveError):
#     """Raised when a save game file is missing"""
#     pass
# 
# Path: magnate/logging.py



import os
from ..errors import MagnateNoSaveGame
from ..logging import log
from . import db






mlog = log.fields(mod=__name__)


#
# Upgrading
#


#
# Game setup mechanics
#

def init_game(savegame, datadir):
    """Initialize a game from a savegame file"""
    flog = mlog.fields(func='init_game')
    flog.fields(savegame=savegame, datadir=datadir).debug('Enter init_game')

    # Finish initializing dynamic parts of the schema
    db.init_schema(datadir)

    savegame = os.path.abspath(savegame)
    try:
        flog.debug('Attempting to load')
        game_state = db.load_savegame(savegame, datadir)

# Path: magnate/errors.py
# class MagnateNoSaveGame(MagnateSaveError):
#     """Raised when a save game file is missing"""
#     pass
# 
# Path: magnate/logging.py



# Path: magnate/savegame/load.py
import os
from ..errors import MagnateNoSaveGame
from ..logging import log
from . import db







mlog = log.fields(mod=__name__)


#
# Upgrading
#


#
# Game setup mechanics
#

def init_game(savegame, datadir):
    """Initialize a game from a savegame file"""
    flog = mlog.fields(func='init_game')
    flog.fields(savegame=savegame, datadir=datadir).debug('Enter init_game')

    # Finish initializing dynamic parts of the schema
    db.init_schema(datadir)

    savegame = os.path.abspath(savegame)
    try:
        flog.debug('Attempting to load')
        game_state = db.load_savegame(savegame, datadir)

    except MagnateNoSaveGame: