I think there's a link in Refar's guide.
That should work - just make sure to get Visual C++.
Last I checked the link still works; it directs to VS 2008. As far as I can tell the two versions are virtually identical.
#ifdef _USRDLL
inline PlayerTypes getOwnerINLINE() const
{
return m_eOwner;
}
#endif
It seems you're trying to access a city that is no longer valid or more likely through a NULL pointer. What is the code that leads to this being called?
You mean it crashes on turn 52 each time you start a new game with a new map and different players??? That's a very good clue, but I have no idea what it means.
A pointer in C++ is the memory address, and many places in the DLL pass around a "CvCity*" which is a pointer to a CvCity object. NULL is just a constant for 0, so a null pointer means a pointer that has not been assigned a real memory address. Address zero is not valid in most processors.
Are you attaching the VS debugger to Civ4 before the crash? If so, it should give you more information than just "crash" when it dies. Also you should be able to walk backwards through the call chain that lead to the crash. That's what I'm talking about what is calling it--not what functions might ever call it but what function is actually calling it that time.
CvCity* pBestYieldCity = NULL;
int iBestCityValue = 0;
int iLoop;
CvCity* pLoopCity;
for(pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop))
{
for (int iProfession = 0; iProfession < GC.getNumProfessionInfos(); ++iProfession)
{
CvProfessionInfo& kLoopProfession = GC.getProfessionInfo((ProfessionTypes)iProfession);
// if (kLoopProfession.getYieldConsumed() == eLoopYield)
//MultipleYieldsConsumed by Aymerick
if (kLoopProfession.getYieldsConsumed(0) == eLoopYield)
//MultipleYieldsConsumed End
{
int iValue = pLoopCity->getProfessionOutput((ProfessionTypes)iProfession, NULL);
if (iValue > 0)
{
iValue *= 100;
iValue += pLoopCity->getPopulation();
if (iValue > iBestCityValue)
{
iBestCityValue = iValue;
pBestYieldCity = pLoopCity;
}
}
}
}
}
yield_dests[eLoopYield] = pBestYieldCity;
[COLOR="Red"] if (GC.getGameINLINE().getGameTurn() > 50)[/COLOR]
{
pBestYieldCity->setMaintainLevel(eLoopYield, pBestYieldCity->getMaxYieldCapacity() / 2);
}