Python Testing Distance

Joined
Sep 15, 2006
Messages
511
I need to make sure that an area has a plot that is over 8 spaces away from the starting plot. How should I do this? I thought of getting every x and y value of every plot then testing it against the starting plot but I can't figure out how to get the indexes of the plots in a certain area.

Any help is greatly appreciated.
 
Theres a TON of distance functions in the CvGamecore.dll .
Checking every single plot for distance to one plot is unnecessarily slow especially because every CyPlot has his own x and y value.

check CyPlot and CyMap python classes
Code:
CyPlot:
BOOL at(INT iX, INT iY)
If the CyPlot exist it exists at (iX:iY)
...Should be easy to find the air distance between 2 coordinates, checking for x and y broder-wrapping needs two IFs.

For a basic approach try...
Code:
CyMap:
INT calculatePathDistance(CyPlot pSource, CyPlot pDest)
finds the shortest passable path between two CyPlots and returns its length, or returns -1 if no such path exists. Note: the path must be all-land or all-water.

Someone might rewrite this function or the function that calculates maintenance cost from capital city distance.
 
Back
Top Bottom