davidlallen
Deity
I have a common code segment I use in python to look at all the adjacent plots:
Now I have a reason to also check if going from pPlot to pPlot2 crosses a river. There is a handy function, CyPlot.isRiverCrossing(DirectionTypes eDirection) which does what I want. However, I can't figure out how to modify my loop to use DirectionTypes. The sdk functions which go from one plot to another by DirectionType aren't exposed in any way I can understand.
Looking in the sdk code, there are functions like cyPlotDirection defined in CyGameCoreUtils.cpp, and there is this declaration in CyGameCoreUtilsInterface.cpp:
But, if this counts as exposing the function to python, I do not understand how to use it.
Can anybody show example python code which uses DirectionTypes to go from one plot to another?
Code:
maxX = CyMap().getGridWidth() ; maxY = CyMap().getGridHeight()
curX = pPlot.getX() ; curY = pPlot.getY()
for iX in range (curX - 1, curX + 2):
if (iX < 0) or (iX >= maxX): continue
for iY in range (curY - 1, curY + 2):
if (iY < 0) or (iY >= maxY): continue
pPlot2 = CyMap().plot(iX, iY)
... do additional stuff
Looking in the sdk code, there are functions like cyPlotDirection defined in CyGameCoreUtils.cpp, and there is this declaration in CyGameCoreUtilsInterface.cpp:
Code:
void CyGameCoreUtilsPythonInterface()
{
OutputDebugString("Python Extension Module - CyGameCoreUtilsPythonInterface\n");
...
python::def("plotDirection", cyPlotDirection, python::return_value_policy<python::manage_new_object>(), "CyPlot* (int iX, int iY, DirectionTypes eDirection)");
Can anybody show example python code which uses DirectionTypes to go from one plot to another?