I am working on writing the AI for my unit, and ran across a problem telling it to go to a certain plot. I debugged it and traced the problem all the way back to CvSelectionGroup::generatePath(), which contains this code:
I tried Right Mouse Button->Go To Definition on GeneratePath() in the code displayed, and I got this:
I know the basics of C++, and read a tutorial on virtual functions, and from what I remember (correct me if I'm wrong), it basically allows a member of a certain class to call a function in another class with the same name using a pointer. It would then follow that generatePath() is in fact a function in a different class, but the only other generatePath() functions I can find are CvSelectionGroup::generatePath() (which calls this function), and CvUnit::generatePath() (which calls CvSelectionGroup::generatePath()).
I have no idea why the game would be unable to generate a path from the specific plots I was dealing with (they were all of 3x1 plots away I believe, I was at war with the owner of the unit, and the unit was supposed to move to my capital). The only reason I can think of is that I set the unit to <bNoCapture>1</bNoCapture>, and my capital was empty at the time, but I think I already made an exception for this in the DLL.
Thanks in advance for the help!
Code:
bSuccess = gDLL->getFAStarIFace()->GeneratePath(&GC.getPathFinder(), pFromPlot->getX_INLINE(), pFromPlot->getY_INLINE(), pToPlot->getX_INLINE(), pToPlot->getY_INLINE(), false, iFlags, bReuse);
return bSuccess;
I tried Right Mouse Button->Go To Definition on GeneratePath() in the code displayed, and I got this:
Code:
class CvDLLFAStarIFaceBase
{
public:
virtual bool GeneratePath(FAStar*, int iXstart, int iYstart, int iXdest, int iYdest, bool bCardinalOnly = false, int iInfo = 0, bool bReuse = false) = 0;
I know the basics of C++, and read a tutorial on virtual functions, and from what I remember (correct me if I'm wrong), it basically allows a member of a certain class to call a function in another class with the same name using a pointer. It would then follow that generatePath() is in fact a function in a different class, but the only other generatePath() functions I can find are CvSelectionGroup::generatePath() (which calls this function), and CvUnit::generatePath() (which calls CvSelectionGroup::generatePath()).
I have no idea why the game would be unable to generate a path from the specific plots I was dealing with (they were all of 3x1 plots away I believe, I was at war with the owner of the unit, and the unit was supposed to move to my capital). The only reason I can think of is that I set the unit to <bNoCapture>1</bNoCapture>, and my capital was empty at the time, but I think I already made an exception for this in the DLL.
Thanks in advance for the help!