from CvPythonExtensions import *
import sys
import Popup as PyPopup
from PyHelpers import PyPlayer
import pickle
import CvEventManager
from CvScreenEnums import *
from PyHelpers import *
import CvUtil
import CvTopCivs
import CvAdvisorUtils
import PyHelpers
import Consts as con
# globals
gc = CyGlobalContext()
localText = CyTranslator()
DefaultUnitAI = UnitAITypes.NO_UNITAI
iTundra = con.iTundra
iThinsoil = con.iThinsoil
iGrass = con.iGrass
iPlains = con.iPlains
iSnow = con.iSnow
TURNS_PER_MONTH = 4
FIRST_YEAR = -4000
def getYear(iGameTurn):
"""Returns the calendar year from the 0-based game turn."""
return iGameTurn / (12 * TURNS_PER_MONTH) + FIRST_YEAR
def getMonth(iGameTurn):
"""Returns the 1-based month # from the 0-based game turn."""
return iGameTurn / TURNS_PER_MONTH + 1
def getWeek(iGameTurn):
"""Returns the 1-based week # from the 0-based game turn."""
return iGameTurn % TURNS_PER_MONTH + 1
tSnowMap = (
tSnowMap = (
(( "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", ),
( "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", ),
( "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", ),
( "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", ),
( "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", ),
( "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", ),
( "0", "0", "40", "40", "0", "0", "0", "0", "60", "0", ),
( "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", ),
( "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", ),
( "0", "0", "0", "0", "0", "0", "0", "0", "0", "0", )),
)
def snowCover(pPlot):
iTurn = gc.getGame().getGameTurn()
iMonth = getMonth(iTurn)
iWeek = getWeek(iTurn)
snowCover = tSnowMap[159-pPlot.getY()][pPlot.getX()]
if iWeek == 1
if iMonth == 1:
if (snowCover != "10"):
pPlot.setTerrainType(iSnow,True,True)
elif (snowCover != "20"):
pPlot.setTerrainType(iSnow,True,True)
elif (snowCover != "30"):
pPlot.setTerrainType(iSnow,True,True)
elif iMonth == 2:
if (snowCover != "40"):
pPlot.setTerrainType(iSnow,True,True)
elif (snowCover != "50"):
pPlot.setTerrainType(iSnow,True,True)
elif (snowCover != "60"):
pPlot.setTerrainType(iSnow,True,True)
elif iMonth == 3:
if (snowCover != "70"):
pPlot.setTerrainType(iSnow,True,True)
elif (snowCover != "80"):
pPlot.setTerrainType(iSnow,True,True)
elif (snowCover != "90"):
pPlot.setTerrainType(iSnow,True,True)
elif (snowCover != "100"):
pPlot.setTerrainType(iSnow,True,True)
elif iMonth == 4:
if (snowCover != "110"):
pPlot.setTerrainType(iSnow,True,True)
elif (snowCover != "120"):
pPlot.setTerrainType(iSnow,True,True)
elif (snowCover != "130"):
pPlot.setTerrainType(iSnow,True,True)
elif (snowCover != "140"):
pPlot.setTerrainType(iSnow,True,True)
elif iMonth == 6:
if (snowCover != "110"):
pPlot.setTerrainType(iTundra,True,True)
elif (snowCover != "120"):
pPlot.setTerrainType(iThinsoil,True,True)
elif (snowCover != "130"):
pPlot.setTerrainType(iGrass,True,True)
elif (snowCover != "140"):
pPlot.setTerrainType(iPlains,True,True)
elif iMonth == 7:
if (snowCover != "70"):
pPlot.setTerrainType(iTundra,True,True)
elif (snowCover != "80"):
pPlot.setTerrainType(iThinsoil,True,True)
elif (snowCover != "90"):
pPlot.setTerrainType(iGrass,True,True)
elif (snowCover != "100"):
pPlot.setTerrainType(iPlains,True,True)
elif iMonth == 8:
if (snowCover != "40"):
pPlot.setTerrainType(iTundra,True,True)
elif (snowCover != "50"):
pPlot.setTerrainType(iThinsoil,True,True)
elif (snowCover != "60"):
pPlot.setTerrainType(iGrass,True,True)
elif iMonth == 9:
if (snowCover != "10"):
pPlot.setTerrainType(iTundra,True,True)
elif (snowCover != "20"):
pPlot.setTerrainType(iThinsoil,True,True)
elif (snowCover != "30"):
pPlot.setTerrainType(iGrass,True,True)