Thanks, Kailric.
I finally looked into the crashes (with a debug DLL attached to VC++). I've posted my initial results, even if I intend to do some more testing.
First, when starting up the mod I got this assert failure:
Code:
Assert Failed
File: CvGlobals.cpp
Line: 2694
Expression: strcmp(szType, "NONE")==0 || strcmp(szType, "")==0
Message: info type UNIT_FORT_SEARGENT not found, Current XML file is: modules\forts\forts_civ4unitinfos.xml
I looked and the UNITCLASS_FORT_OFFICER points to UNIT_FORT_SEARGENT, but this unit doesn't exist in the Forts module.
Should I just delete the unitclass? Or is there supposed to be a UNIT_FORT_SEARGENT but I got rid of it when removing all the excess units from Forts_CIV4UnitInfos.xml?
Anyway, here are the actual error messages when beginning a game for the first time:
Code:
Assert Failed
File: CvPlayerAI.cpp
Line: 7842
Expression: false
Message:
----------------------------------------------------------
Assert Failed
File: CvTeam.cpp
Line: 2289
Expression: eIndex >= 0
Message: eIndex is expected to be non-negative (invalid Index)
----------------------------------------------------------
Assert Failed
File: CvUnit.cpp
Line: 8187
Expression: !at(iX, iY) || (iX == INVALID_PLOT_COORD) || (iY == INVALID_PLOT_COORD)
Message:
----------------------------------------------------------
Assert Failed
File: CvUnit.cpp
Line: 8533
Expression: pOldPlot != pNewPlot || pNewPlot == NULL
Message:
The first one would appear to be the result of not adding a case YIELD_COAL to a loop in CvPlayerAI.cpp that goes through all yields. I guess I'd just add something like this:
Code:
case YIELD_COAL:
iValue += kParent.getYieldSellPrice(eYield);
break;
To the loop (shown in spoiler tag)?
The next is in this function in CvTeam.cpp:
Code:
bool CvTeam::isOpenBorders(TeamTypes eIndex) const
{
FAssertMsg(eIndex >= 0, "eIndex is expected to be non-negative (invalid Index)");
FAssertMsg(eIndex < MAX_TEAMS, "eIndex is expected to be within maximum bounds (invalid Index)");
if (isAtWar(eIndex))
{
return false;
}
return m_abOpenBorders[eIndex];
}
The bug would seem to be that an eIndex of -1 is being passed to isOpenBorders. Not sure from where though (I'll look into that further).
Next assert failures are in CvUnit::setXY. I suspect that they are related to HCOM, which moves a player's starting units to a randomly-generated starting position. If the plot is invalid, then it's going to cause problems- possibly even a crash. But I'm not sure about that. All that I can tell is that some unit is being moved to the same plot it was at before, or it's being moved to an invalid plot.
However, what's interesting is that the game doesn't actually crash- but it does if I run without the debug DLL.