# Put stuff in cities
for i,city in enumerate(cityList) :
cityX = city.getX()
cityY = city.getY()
if( not iBestDefender == UnitTypes.NO_UNIT ) : pyNewPlayer.initUnit(iBestDefender,cityX,cityY,3)
if( not iWorker == UnitTypes.NO_UNIT ) : pyNewPlayer.initUnit(iWorker,cityX,cityY,1)
if( city.getPopulation() < 3 ) :
city.setPopulation(3)
if( city.getPopulation() < 6 ) :
city.changePopulation( game.getSorenRandNum(7-city.getPopulation(),'BarbarianCiv: change city population') )
if( self.LOG_DEBUG ) : CvUtil.pyPrint(" BC - New population of %s is %d"%(city.getName(),city.getPopulation()))
if( barbSettleType == 1 ) : # Military
extraUnits = int( [b](gc.getActivePlayer().getCurrentEra()[/b]+1)/2.0 )
if( len(closePlayers) == 0 ) : # Viking style, no horsies (but still allows elephants ... )
if( not iCounter == UnitTypes.NO_UNIT ) : pyNewPlayer.initUnit(iCounter,cityX,cityY,2+game.getSorenRandNum(5+[b]extraUnits[/b],'BarbarianCiv: give military infantry'))
if( not iAttack == UnitTypes.NO_UNIT ) : pyNewPlayer.initUnit(iAttack,cityX,cityY,2+game.getSorenRandNum(5+[b]extraUnits[/b],'BarbarianCiv: give military mobile'))
else :
if( not iCounter == UnitTypes.NO_UNIT ) : pyNewPlayer.initUnit(iCounter,cityX,cityY,1+game.getSorenRandNum(4+[b]extraUnits[/b],'BarbarianCiv: give military infantry'))
if( not iMobile == UnitTypes.NO_UNIT ) : pyNewPlayer.initUnit(iMobile,cityX,cityY,1+game.getSorenRandNum(4+[b]extraUnits[/b],'BarbarianCiv: give military mobile'))
if( not iAttack == UnitTypes.NO_UNIT ) : pyNewPlayer.initUnit(iAttack,cityX,cityY,1+game.getSorenRandNum(4+[b]extraUnits[/b],'BarbarianCiv: give military mobile'))
if( city.canConstruct( iBarracks ) ) :
if( self.LOG_DEBUG ) : CvUtil.pyPrint(" BC - Constructing %s in %s"%(PyInfo.BuildingInfo(iBarracks).getDescription(),city.getName()))
city.setHasRealBuildingIdx(iBarracks,True)
elif( barbSettleType == 2 ) : # Builder
if( city.canConstruct( iLibrary ) ) :
if( self.LOG_DEBUG ) : CvUtil.pyPrint(" BC - Constructing %s in %s"%(PyInfo.BuildingInfo(iLibrary).getDescription(),city.getName()))
city.setHasRealBuildingIdx(iLibrary,True)
if( city.canConstruct( iLighthouse ) ) :
if( self.LOG_DEBUG ) : CvUtil.pyPrint(" BC - Constructing %s in %s"%(PyInfo.BuildingInfo(iLighthouse).getDescription(),city.getName()))
city.setHasRealBuildingIdx(iLighthouse,True)
if( city.canConstruct( iGranary ) ) :
if( self.LOG_DEBUG ) : CvUtil.pyPrint(" BC - Constructing %s in %s"%(PyInfo.BuildingInfo(iGranary).getDescription(),city.getName()))
city.setHasRealBuildingIdx(iGranary,True)
iTotCul = city.GetCy().countTotalCulture()
if( iTotCul > 0 ) :
city.setCulture( int(iTotCul/2.0) )
if( self.LOG_DEBUG ) : CvUtil.pyPrint(" BC - Culture of %s set to %d"%(city.getName(),city.getCulture()))
if( self.LOG_DEBUG ) : CvUtil.pyPrint(" BC - %d units placed in %s"%(city.plot().getNumUnits(),city.getName()))