Hier ein Vorschlag, der ein wenig schneller laufen müsste, als die aktuelle Version
Code:
def onGameStart(self, argsList):
'Called at the start of the game'
### Starting points part 2 ###
MapName = CyMap().getMapScriptName ()
sScenarioScriptData = CyMap().plot(0, 0).getScriptData()
if not gc.getGame().isOption(GameOptionTypes.GAMEOPTION_ADVANCED_START) and gc.getGame().getGameTurnYear() == gc.getDefineINT("START_YEAR"):
MapName = ""
# PAE Maps
if sScenarioScriptData == "EuropeStandard": MapName = "StartingPoints_EuropeStandard.xml"
elif sScenarioScriptData == "EuropeMini": MapName = "StartingPoints_EuropeMini.xml"
elif sScenarioScriptData == "EuropeMedium": MapName = "StartingPoints_EuropeMedium.xml"
elif sScenarioScriptData == "EuropeLarge": MapName = "StartingPoints_EuropeLarge.xml"
elif sScenarioScriptData == "EuropeSmall": MapName = "StartingPoints_EuropeSmall.xml"
elif sScenarioScriptData == "SchmelzEuro": MapName = "StartingPoints_EuropeLarge.xml"
elif sScenarioScriptData == "EuropeXL": MapName = "StartingPoints_EuropeXL.xml"
if MapName != "":
Debuging = False
AddPositionsToMap = False
MyFile = open("Mods/PieAncientEuropeV/Assets/XML/Misc/" + MapName)
StartingPointsUtil.ReadMyFile(MyFile,Debuging,AddPositionsToMap)
MyFile.close()
# --------------------------------
# --------------------------------
iEra = gc.getGame().getStartEra()
# +++++ Special dawn of man texts for Szenario Maps in PAE in CvDawnOfMan.py ++++++++++++++++++++++++++++++++
lTechs = []
lTechs.append(gc.getInfoTypeForString("TECH_NONE"))
lTechs.append(gc.getInfoTypeForString("TECH_TECH_INFO_1"))
lTechs.append(gc.getInfoTypeForString("TECH_TECH_INFO_2"))
lTechs.append(gc.getInfoTypeForString("TECH_TECH_INFO_3"))
lTechs.append(gc.getInfoTypeForString("TECH_TECH_INFO_4"))
lTechs.append(gc.getInfoTypeForString("TECH_TECH_INFO_5"))
lTechs.append(gc.getInfoTypeForString("TECH_TECH_INFO_6"))
lTechs.append(gc.getInfoTypeForString("TECH_TECH_INFO_7"))
lTechs.append(gc.getInfoTypeForString("TECH_TECH_INFO_8"))
lTechsReli = []
lTechsReli.append(gc.getInfoTypeForString("TECH_RELIGION_NORDIC"))
lTechsReli.append(gc.getInfoTypeForString("TECH_RELIGION_CELTIC"))
lTechsReli.append(gc.getInfoTypeForString("TECH_RELIGION_HINDU"))
lTechsReli.append(gc.getInfoTypeForString("TECH_RELIGION_EGYPT"))
lTechsReli.append(gc.getInfoTypeForString("TECH_RELIGION_SUMER"))
lTechsReli.append(gc.getInfoTypeForString("TECH_RELIGION_GREEK"))
lTechsReli.append(gc.getInfoTypeForString("TECH_RELIGION_PHOEN"))
lTechsReli.append(gc.getInfoTypeForString("TECH_RELIGION_ROME"))
lTechsReli.append(gc.getInfoTypeForString("TECH_DUALISMUS"))
lTechsReli.append(gc.getInfoTypeForString("TECH_MONOTHEISM"))
lTechsReli.append(gc.getInfoTypeForString("TECH_ASKESE"))
lTechsReli.append(gc.getInfoTypeForString("TECH_MEDITATION"))
iTechRome = gc.getInfoTypeForString("TECH_ROMAN")
iTechGreek = gc.getInfoTypeForString("TECH_GREEK")
lCivsRome = []
lCivsRome.append(gc.getInfoTypeForString("CIVILIZATION_ROME"))
lCivsRome.append(gc.getInfoTypeForString("CIVILIZATION_ETRUSCANS"))
lCivsGreek = []
lCivsGreek.append(gc.getInfoTypeForString("CIVILIZATION_GREECE"))
lCivsGreek.append(gc.getInfoTypeForString("CIVILIZATION_ATHENS"))
lCivsGreek.append(gc.getInfoTypeForString("CIVILIZATION_SPARTA"))
lCivsGreek.append(gc.getInfoTypeForString("CIVILIZATION_THEBAI"))
lCivsGreek.append(gc.getInfoTypeForString("CIVILIZATION_MACEDONIA"))
# +++++ Corrections in scenarios ++++++++++++++++++++++++++++++++
iRange = gc.getMAX_PLAYERS()
for iPlayer in range(iRange):
player = gc.getPlayer(iPlayer)
if player.isAlive():
# +++++ Correct naming for units (not available in BTS)
iNumUnits = player.getNumUnits()
for j in range(iNumUnits):
UnitText = player.getUnit(j).getName()
if UnitText[:7] == "TXT_KEY":
sz = UnitText.split()
sTranslatedName = CyTranslator().getText(str(sz[0]),("",))
player.getUnit(j).setName(sTranslatedName)
# +++++ Check city status
iNumCities = player.getNumCities()
for i in range (iNumCities):
city = player.getCity(iPlayer)
if not city.isNone():
self.doCheckCityState(city)
if player.hasTrait(gc.getInfoTypeForString("TRAIT_MARITIME")):
iBuilding = gc.getInfoTypeForString("BUILDING_MARITIME")
city.setNumRealBuilding(iBuilding,1)
#Start in spaeterer Aera -> unerforschbare und Relitechs entfernen
#Start in later era -> remove unresearchable and religious techs
# Scenarios ausgeschlossen!!!
if sScenarioScriptData == "":
iTeam = player.getTeam()
pTeam = gc.getTeam(iTeam)
for iTech in lTechs:
pTeam.setHasTech(iTech, 0, iPlayer, 0, 0)
if iEra > 0:
for iTech in lTechsReli:
pTeam.setHasTech(iTech, 0, iPlayer, 0, 0)
if player.getCivilizationType() not in lCivsRome:
pTeam.setHasTech(iTechRome, 0, iPlayer, 0, 0)
if player.getCivilizationType() not in lCivsGreek:
pTeam.setHasTech(iTechGreek, 0, iPlayer, 0, 0)
if player.isHuman():
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_PYTHON_SCREEN)
popupInfo.setText(u"showDawnOfMan")
popupInfo.addPopup(iPlayer)
# ++++ Das Zedernholz benoetigt Savanne. Da es in den BONUS-Infos nicht funktioniert, muss es manuell gemacht werden
feat_forest = gc.getInfoTypeForString("FEATURE_SAVANNA")
bonus_zedern = gc.getInfoTypeForString("BONUS_ZEDERNHOLZ")
iMapW = gc.getMap().getGridWidth()
iMapH = gc.getMap().getGridHeight()
for x in range(iMapW):
for y in range(iMapH):
loopPlot = gc.getMap().plot(x,y)
if loopPlot != None and not loopPlot.isNone() and loopPlot.getBonusType(-1) == bonus_zedern and loopPlot.getFeatureType() != feat_forest:
loopPlot.setFeatureType(feat_forest,1)
# -----------
# BTS Standard
if gc.getGame().isPbem():
iRange = gc.getMAX_PLAYERS()
for iPlayer in range(iRange):
player = gc.getPlayer(iPlayer)
if (player.isAlive() and player.isHuman()):
popupInfo = CyPopupInfo()
popupInfo.setButtonPopupType(ButtonPopupTypes.BUTTONPOPUP_DETAILS)
popupInfo.setOption1(True)
popupInfo.addPopup(iPlayer)
CvAdvisorUtils.resetNoLiberateCities()