I'm trying to make a building work like airports did in Civ 3, where any city with an airport is connected to any other city with an airport. Phungus420 was trying to help me and I wound up with this, which I put in CvEventManager. On loading my mod, I got a series of exceptions ending in "Can't assign to a function call" or something like that, and the modified CvEventManager failing to load.
def onBuildingBuilt(self, argsList):
'Building Completed'
pCity, iBuildingType = argsList
game = gc.getGame()
#Phungus's Snippet
pCapitol=pPlayer.getCapitalCity()
iAirport=gc.getTypeForString("BUILDING_SPACEPORT")
if(pCity.getNumRealBuilding(iAirport)>0):
pCity.isConnectedTo(pCapitol)=true
#End Phungus's Snippet
isConnectedTo is a function in CvCity and getCapitalCity is a real function with bad spelling in CvPlayer. However creating the variable pCapitol and setting it equal to the value returned for the capitol city doesn't allow isConnected to to be set equal to it. I guess that's because isConnectedTo is a function that gets that value whenever any function needs it, and doesn't retain it, so you can't just go in from outside and set it, an object oriented type thing, but if not this way then how?
def onBuildingBuilt(self, argsList):
'Building Completed'
pCity, iBuildingType = argsList
game = gc.getGame()
#Phungus's Snippet
pCapitol=pPlayer.getCapitalCity()
iAirport=gc.getTypeForString("BUILDING_SPACEPORT")
if(pCity.getNumRealBuilding(iAirport)>0):
pCity.isConnectedTo(pCapitol)=true
#End Phungus's Snippet
isConnectedTo is a function in CvCity and getCapitalCity is a real function with bad spelling in CvPlayer. However creating the variable pCapitol and setting it equal to the value returned for the capitol city doesn't allow isConnected to to be set equal to it. I guess that's because isConnectedTo is a function that gets that value whenever any function needs it, and doesn't retain it, so you can't just go in from outside and set it, an object oriented type thing, but if not this way then how?