I have found a bug in the DLL. Attached below is a fix for it.
In a rare circumstance the game can fall over dead, with a "crash to desktop" type problem.
It turns out that the code for a unit withdrawing from combat does not check for the edge of the map. If it is being attacked from a direction opposite the edge it will try to move the unit off the edge. This makes it call CvUnit::canMoveInto with a plot of NULL.
The fix requires a new DLL. In mine, rather than fixing it in the combat code which calls the function with a NULL plot, I have added a check for that at the start of CvUnit::canMoveInto which causes it to return false if the plot is NULL. Doing it this way means that any other such bug anywhere in the code will not crash it either. (I also commented out the assert that checks that the plot is not NULL.)
Like so:
Code:
bool CvUnit::canMoveInto(const CvPlot* pPlot, bool bAttack, bool bDeclareWar, bool bIgnoreLoad) const
{
// FAssertMsg(pPlot != NULL, "Plot is not assigned a valid value");
if (pPlot == NULL) { // Post 1.83 - it turns out a unit can try to withdraw off the map if it doesn't wrap
return false;
}
... no more changes after this
Attached is a patched DLL. If you run into this problem, replace the CvGameCoreDLL.dll file in <location of your BTS mods folder>\Final Frontier Plus\Assets with the one in the attached zip file. (Or if you just want to pre-emptively do so to avoid the problem.) OK, just to be safe, you should rename the existing one rather than just replacing it so you can revert if it doesn't work. Since the bugfix is the only change to the DLL it is compatible with saves from 1.83.