############################LAND_WATER/WATER_LAND###########################
iWaterland1 = gc.getInfoTypeForString('IMPROVEMENT_WATERLAND1')
iWaterland2 = gc.getInfoTypeForString('IMPROVEMENT_WATERLAND2')
#GreenMod: get city for terraform checks
if (iImprovement==iWaterland1 or iImprovement==iWaterland2):
bCityCheck = 0
for x in [-2,-1,0,1,2]:
for y in [-2,-1,0,1,2]:
if CyMap().plot(iX +x, iY +y).isCity() == 1:
iCityX = iX +x
iCityY = iY +y
pCity = CyMap().plot(iX +x, iY +y).getPlotCity()
bCityCheck = 1
#GreenMod: water and land switching, PART1
if iImprovement==iWaterland1:
#if built on water (coast), for later upgrade to land
if pPlot.getTerrainType() == 5:
#not city near, so delete it
if not bCityCheck == 1:
pPlot.setImprovementType(-1)
else:
#if on land and has just been upgraded to, make to water
pPlot.setImprovementType(-1)
pPlot.setTerrainType(5, 1, 1)
#GreenMod: now the other direction, terraform, PART2
if iImprovement==iWaterland2:
#if built on land (any), for later upgrade to water
if not pPlot.getTerrainType() == 5:
#not city near, so delete it
if not bCityCheck == 1:
pPlot.setImprovementType(-1)
else:
#if on water and has just been upgraded to, make to land
pPlot.setImprovementType(-1)
#city terrain will be terrain of new land
iNewTerrain = 2
iNewTerrain = CyMap().plot(iCityX, iCityY).getTerrainType()
pPlot.setTerrainType(iNewTerrain, 1, 1)
#ocean next to new land? becomes coast now
for x in [-1,0,1]:
for y in [-1,0,1]:
if CyMap().plot(iX +x, iY +y).getTerrainType() == 6:
CyMap().plot(iX +x, iY +y).setTerrainType(5, 1, 1)
#GreenMod: recalculate city graphics after terraform, PART3
if (iImprovement==iWaterland1 or iImprovement==iWaterland2):
#reset or remove harbor and drydock if no coast near
iHarbor = gc.getCivilizationInfo(pCity.getCivilizationType()).getCivilizationBuildings(gc.getInfoTypeForString("BUILDINGCLASS_HARBOR"))
iLighthouse = gc.getCivilizationInfo(pCity.getCivilizationType()).getCivilizationBuildings(gc.getInfoTypeForString("BUILDINGCLASS_LIGHTHOUSE"))
iDrydock = gc.getCivilizationInfo(pCity.getCivilizationType()).getCivilizationBuildings(gc.getInfoTypeForString("BUILDINGCLASS_DRYDOCK"))
iCustomHouse = gc.getCivilizationInfo(pCity.getCivilizationType()).getCivilizationBuildings(gc.getInfoTypeForString("BUILDINGCLASS_CUSTOM_HOUSE"))
if pCity.isCoastal(10):
if pCity.isHasBuilding(iHarbor):
pCity.setNumRealBuilding(iHarbor, 0)
pCity.setNumRealBuilding(iHarbor, 1)
else:
pCity.setNumRealBuilding(iHarbor, 1)
pCity.setNumRealBuilding(iHarbor, 0)
if pCity.isHasBuilding(iLighthouse):
pCity.setNumRealBuilding(iLighthouse, 0)
pCity.setNumRealBuilding(iLighthouse, 1)
else:
pCity.setNumRealBuilding(iLighthouse, 1)
pCity.setNumRealBuilding(iLighthouse, 0)
if pCity.isHasBuilding(iDrydock):
pCity.setNumRealBuilding(iDrydock, 0)
pCity.setNumRealBuilding(iDrydock, 1)
else:
pCity.setNumRealBuilding(iDrydock, 1)
pCity.setNumRealBuilding(iDrydock, 0)
if pCity.isHasBuilding(iCustomHouse):
pCity.setNumRealBuilding(iCustomHouse, 0)
pCity.setNumRealBuilding(iCustomHouse, 1)
else:
pCity.setNumRealBuilding(iCustomHouse, 1)
pCity.setNumRealBuilding(iCustomHouse, 0)
else:
pCity.setNumRealBuilding(iHarbor, 0)
pCity.setNumRealBuilding(iLighthouse, 0)
pCity.setNumRealBuilding(iDrydock, 0)
pCity.setNumRealBuilding(iCustomHouse, 0)
#gmend
##################################HRADY_START##################################