Let's say you have a plot: pPlot. How do you find the nearest city to that plot?
Roger Bacon
Roger Bacon
# find the nearest city to the plot whose co-ordinates are < iX, iY > CyCity findCity(INT iX, # X co-ordinate INT iY, # Y co-ordinate PlayerType eOwner, # owner of the desired city TeamType eTeam, # team that city owner belongs to BOOL bSameArea, # set false if you want to look outside of the area that # < iX, iY > is in BOOL bCoastalOnly, # set true if you want to look only for coastal cities TeamType eTeamAtWarWith, # if defined will only look for cities whose owner is at # war with the specified team DirectionType eDirection, # if specified, will look for cities in that direction CyCity pSkipCity # if specified, will skip this city ) Defaults: CyCity* (int iX, int iY, int (PlayerTypes) eOwner = NO_PLAYER, int (TeamTypes) eTeam = NO_TEAM, bool bSameArea = true, bool bCoastalOnly = false, int (TeamTypes) eTeamAtWarWith = NO_TEAM, int (DirectionTypes) eDirection = NO_DIRECTION, CvCity* pSkipCity = NULL)
pMap = CyMap() class MyObject: def AnyFunc(): ... nearestCity = pMap.findCity(iX, iY) ...
class MyObject: def AnyFunc(): ... pMap = CyMap() ... nearestCity = pMap.findCity(iX, iY) ...
nearestCity = CyMap().findCity(iX, iY, pPlot.getOwner(), NO_TEAM, True, False, NO_TEAM, NO_DIRECTION, NULL)
nearestCity = gc.getMap().findCity(iX, iY)
Comment