Exemplo n.º 1
0
def saveGameEnd():
    """
	Saves the single-player game when the game ends.
	"""
    if not CyGame().isGameMultiPlayer() and options.isCreateEndSave(
    ) and not MapFinder.isActive():
        saveGame()
Exemplo n.º 2
0
def saveGameExit():
    """
	Saves the single-player game when the player exits to the main menu or desktop.
	"""
    if not CyGame().isGameMultiPlayer() and options.isCreateExitSave(
    ) and not MapFinder.isActive():
        saveGame()
Exemplo n.º 3
0
def saveGameStart():
    """
	Saves the single-player game when the map is generated as long as MapFinder isn't active.
	"""
    if not CyGame().isGameMultiPlayer() and options.isCreateStartSave(
    ) and not MapFinder.isActive():
        saveGame()
Exemplo n.º 4
0
def saveGameStart():
    """
	Saves the single-player game when the map is generated as long as MapFinder isn't active.
	
	Checks the CRCs and map settings if BUFFY is active.
	
	NOTE: The save is created and deleted in some cases because it is needed to check the CRCs.
	      Do not try to optimize this unless you are sure you know what's up!
	"""
    if not CyGame().isGameMultiPlayer() and not MapFinder.isActive():
        fileName = AutoSave.saveGame()
        if isNeedToCheckCRCs():
            checkCRCs(fileName)
            if not settingsOK():
                BugUtil.error(getWarningMessage())
        if not AutoSaveOpt.isCreateStartSave():
            os.remove(fileName)
def saveGameStart():
	"""
	Saves the single-player game when the map is generated as long as MapFinder isn't active.
	
	Checks the CRCs and map settings if BUFFY is active.
	
	NOTE: The save is created and deleted in some cases because it is needed to check the CRCs.
	      Do not try to optimize this unless you are sure you know what's up!
	"""
	if not CyGame().isGameMultiPlayer() and not MapFinder.isActive():
		fileName = AutoSave.saveGame()
		if isNeedToCheckCRCs():
			checkCRCs(fileName)
			if not settingsOK():
				BugUtil.error(getWarningMessage())
		if not AutoSaveOpt.isCreateStartSave():
			os.remove(fileName)
Exemplo n.º 6
0
def getSaveFileName(pathName):
    if pathName:
        activePlayer = PlayerUtil.getActivePlayer()
        if not MapFinder.isActive() and options.isUsePlayerName():
            fileName = activePlayer.getName()
            turnYear = CyGameTextMgr().getTimeStr(gc.getGame().getGameTurn(),
                                                  False)
            fileName += '_' + turnYear.replace(" ", "-")
        else:
            objLeaderHead = gc.getLeaderHeadInfo(
                activePlayer.getLeaderType()).getText()

            game = gc.getGame()
            map = gc.getMap()

            difficulty = gc.getHandicapInfo(
                activePlayer.getHandicapType()).getText()
            mapType = os.path.basename(map.getMapScriptName())
            mapSize = gc.getWorldInfo(map.getWorldSize()).getText()
            mapClimate = gc.getClimateInfo(map.getClimate()).getText()
            mapLevel = gc.getSeaLevelInfo(map.getSeaLevel()).getText()
            era = gc.getEraInfo(game.getStartEra()).getText()
            speed = gc.getGameSpeedInfo(game.getGameSpeedType()).getText()
            turnYear = CyGameTextMgr().getTimeStr(game.getGameTurn(), False)
            turnYear = turnYear.replace(" ", "-")
            turnYear = turnYear.replace(",", "-")

            fileName = objLeaderHead[0:3]
            fileName += '_' + difficulty[0:3]
            fileName += '_' + mapSize[0:3]
            fileName += '_' + mapType[0:3]
            fileName += '_' + speed[0:3]
            fileName += '_' + era[0:3]
            fileName += '_' + turnYear
            fileName += '_' + mapClimate[0:3]
            fileName += '_' + mapLevel[0:3]

        fileName = BugPath.join(pathName, fileName)
        baseFileName = CvUtil.convertToStr(fileName)
        fileName = CvUtil.convertToStr(fileName + '_' +
                                       time.strftime("%b-%d-%Y_%H-%M-%S"))

        return (fileName, baseFileName)
Exemplo n.º 7
0
def getSaveFileName(pathName):
	if pathName:
		activePlayer = PlayerUtil.getActivePlayer()
		if not MapFinder.isActive() and options.isUsePlayerName():
			fileName = activePlayer.getName()
			turnYear = CyGameTextMgr().getTimeStr(gc.getGame().getGameTurn(), False)
			fileName += '_' + turnYear.replace(" ", "-")
		else:
			objLeaderHead = gc.getLeaderHeadInfo (activePlayer.getLeaderType()).getText()
			
			game = gc.getGame()
			map = gc.getMap()
			
			difficulty = gc.getHandicapInfo(activePlayer.getHandicapType()).getText()
			mapType = os.path.basename(map.getMapScriptName())
			mapSize = gc.getWorldInfo(map.getWorldSize()).getText()
			mapClimate = gc.getClimateInfo(map.getClimate()).getText()
			mapLevel = gc.getSeaLevelInfo(map.getSeaLevel()).getText()
			era = gc.getEraInfo(game.getStartEra()).getText()
			speed = gc.getGameSpeedInfo(game.getGameSpeedType()).getText()
			turnYear = CyGameTextMgr().getTimeStr(game.getGameTurn(), False)
			turnYear = turnYear.replace(" ", "-")
			turnYear = turnYear.replace(",", "-")

			fileName = objLeaderHead[0:3]
			fileName += '_' + difficulty[0:3]
			fileName += '_' + mapSize[0:3]
			fileName += '_' + mapType[0:3]
			fileName += '_' + speed[0:3]
			fileName += '_' + era[0:3]
			fileName += '_' + turnYear
			fileName += '_' + mapClimate[0:3]
			fileName += '_' + mapLevel[0:3]

		fileName = BugPath.join(pathName, fileName)
		baseFileName = CvUtil.convertToStr(fileName)
		fileName = CvUtil.convertToStr(fileName + '_' + time.strftime("%b-%d-%Y_%H-%M-%S"))

		return (fileName, baseFileName)
Exemplo n.º 8
0
def saveGameExit():
	"""
	Saves the single-player game when the player exits to the main menu or desktop.
	"""
	if not CyGame().isGameMultiPlayer() and options.isCreateExitSave() and not MapFinder.isActive():
		saveGame()
Exemplo n.º 9
0
def saveGameEnd():
	"""
	Saves the single-player game when the game ends.
	"""
	if not CyGame().isGameMultiPlayer() and options.isCreateEndSave() and not MapFinder.isActive():
		saveGame()
Exemplo n.º 10
0
def saveGameStart():
	"""
	Saves the single-player game when the map is generated as long as MapFinder isn't active.
	"""
	if not CyGame().isGameMultiPlayer() and options.isCreateStartSave() and not MapFinder.isActive():
		saveGame()