OrionVeteran
Deity
I am having a problem with the following function:
The code fails to get beyond the red line. I don't know why.
Spoiler :
Code:
def isAdjacentCityPlot(pUnit):
# Orion's Army Mod
# Returns True if the unit is on a plot adjacent to a city
# Returns False if the unit is Not on a plot adjacent to a city
isAdjacentPlot = False
iOwner = pUnit.getOwner()
iPlotX = pUnit.getX()
iPlotY = pUnit.getY()
pUnitPlot = CyMap().plot(iPlotX, iPlotY)
for iGamePlayer in range(gc.getMAX_PLAYERS()):
GamePlayer = gc.getPlayer(iGamePlayer)
if GamePlayer.isAlive():
for iCity in range(GamePlayer.getNumCities()):
pCity = GamePlayer.getCity(iCity)
iCityOwner = pCity.getOwner()
iX = pCity.getX()
iY = pCity.getY()
pCityPlot = CyMap().plot(iX, iY)
if iCityOwner != iOwner:
for iPlotLoop in range(CyMap().numPlots()):
pLoopPlot = CyMap().plotByIndex(iPlotLoop)
if pLoopPlot != pCityPlot:
iDistanceFromCity = CyMap().calculatePathDistance(pCityPlot, pLoopPlot)
if iDistanceFromCity == 1:
if (pLoopPlot.getOwner() != -1):
CyInterface().addImmediateMessage("B", "")
[COLOR="Red"]if pUnitPlot == pLoopPlot:[/COLOR]
CyInterface().addImmediateMessage("Found Adjacent Plot", "")
isAdjacentPlot = True
break
break
break
The code fails to get beyond the red line. I don't know why.