Event problems

j_mie6

Deity
Joined
Dec 20, 2009
Messages
2,963
Location
Bristol (uni)/Swindon (home)
I am having a problem with an event I have made for my mod and was hoping you could tell me what is wrong:

Traceback (most recent call last):
File "CvEventInterface", line 23, in onEvent
File "CvEventManager", line 188, in handleEvent
File "CvEventManager", line 393, in onBeginGameTurn
File "ModEvents", line 153, in eventReinforce
File "Helpers", line 69, in flipCity
RuntimeError
:
unidentifiable C++ exception

The code:
Code:
##ERE Reinforce##
iNumCities = 4
iReinforceDate = "395:4"
tERETop = (55, 30)
tEREBottom = (40, 23)
reinforceMessage = "TXT_KEY_MODEVENTS_REINFORCE_MESSAGE"
pByzantium = instance(eByzantium)
iEREUnits = 3
def eventReinforce():
    if getNumPlayerCities(eByzantium) < iNumCities and isDate(iReinforceDate) and pByzantium.isAlive():
        print "Reiforce triggered!"
        for pCity in [b]findAreaCities(tEREBottom, tERETop)[/b]:
            if not pCity.isCapital():
                [b]flipCity(eByzantium, pCity)[/b]
                spawnCityGarrison(pByzantium, pCity, iEREUnits)
                addMessage(reinforceMessage, (), eWhite) #Blue/Cyan?
Code:
def findAreaCities(tCoords1, tCoords2):
        """
        Used for looping. When supplied with the map coordinates of a area defined by its
        lower left corner (tCoords1) and its upper right corner (tCoords2), the function
        yields all cities (CyCity instances) in order.
        """
        iX1, iY1 = tCoords1
        iX2, iY2 = tCoords2
        for iX in range(iX1, iX2 + 1):
                for iY in range(iY1, iY2 + 1):
                        pPlot = Map.plot(iX, iY)
                        #pPlot = getPlot((iX, iY))
                        if pPlot.isCity():
                                yield pPlot.getPlotCity()
                                #yield getPlotCity((iX, iY))
Code:
def flipCity(ePlayer, pCity, bConquored = False, bTrade = False):
        instance(ePlayer).get(CyPlayer).acquireCity(pCity, bConquored, bTrade)

and I making some kind of stupid mistake with mixing up class instances and thing?

on a side note I have some code which uses the flipCity function correctly:

flipCity(eRome, getPlotCity(tByzantium))

where tByzantium = (46, 27)

and getPlotCity()

Code:
def getPlotCity(tCoords):
       return getPlot(tCoords).getPlotCity()
with getPlot being:
Code:
def getPlot(tCoords): 
        """ 
        Returns the CyPlot instance of the plot at tCoords. 
        """ 
        iX, iY = tCoords 
        return Map.plot(iX, iY)
and Map = CyMap()

This uses Baldyr's CivPlayer module!
 
Back
Top Bottom