CTDs and Stuff

I think I located at least part of the problem for Eugenics Wars. When I replaced the new Civ4UnitInfos.xml file with the old one from 300, the game on loading gives an xml file error, but no longer crashes to desktop. I got the idea that something may have been wrong there by looking at my error log files, as it was always crashing right after loading that file.

I don't really know if this helps any. Personally, I liked the way 300 played and wasn't really looking forward to the changes for 323.;)

Edited: Also, I didn't bother trying to play the game, just tried loading it to see if it worked.
 
No. The log file just listed that file as the last one loaded. The only errors that popped up in the game while loading was the standard crash message saying it needs to shut down. That message did not show up using the 300 file, but xml errors did pop up while loading that (expected, since that file wasn't meant to be ran with the rest of 323).

Here is the relevant lines from the log file on my last load attempt:
Code:
[4048.491] Wrote Units to cache
[4048.491] info type UNIT_MORNING_STAR not found, Current XML file is: xml\Units/CIV4UnitInfos.xml
[4048.491] info type UNIT_TACTICAL_NUKE not found, Current XML file is: xml\Units/CIV4UnitInfos.xml
[4048.491] Loading XML file xml\Civilizations/CIV4UnitArtStyleTypeInfos.xml
[4048.506] Load XML file xml\Civilizations/CIV4UnitArtStyleTypeInfos.xml SUCCEEDED
 
I think I discovered the problems in two files (at least the game loads/plays with no CTD or xml errors). Attachments below, with the original files included.

Edit:Here is the code in the unitsinfo file that was causing the crash. I think you forgot to include an updated CIV4ArtDefines_Unit.xml file. It was easier for me to change the first file than the second.
Code:
<EarlyArtDefineTag>ART_DEF_UNIT_MORNING_STAR</EarlyArtDefineTag>
 

Attachments

There's no issue with Civ4BuildingInfos.xml (or even directly with either file). They are supposed to be that way in 3.23 (due to the Morning Star changes). What happened was I forgot to include the new version of Civ4ArtDefines_Units.xml in the patch. I'm reuploading the patch; download it again in about 10 minutes.

Does anyone have any idea about the CTD in the main mod? I've asked the person who reported it for a save but haven't gotten a response. He seems to have disappeared.
 
There's no issue with Civ4BuildingInfos.xml (or even directly with either file). They are supposed to be that way in 3.23 (due to the Morning Star changes).

I only changed that file because I was getting xml errors, but not crashes.
What happened was I forgot to include the new version of Civ4ArtDefines_Units.xml in the patch. I'm reuploading the patch; download it again in about 10 minutes.

I saw this after my above edit;)
 
I'm d/l now, but atomicgamer doesn't like me very much and it is pretty slow. I'm sure that once I replace the missing file and revert to your original files everything will work fine. I would have just done it myself, but as I said the art file was harder to change for me than the unit file.:)

Edit: OK; works now. Thanks!
 
I've compiled a debug DLL for 3.23 with Inhabited Planets included. That makes testing for crashes imprecise... but I thought I'd share my results anyway.

I get a probably unrelated assert failure when starting a game:

Code:
Assert Failed

File:  CvPlot.cpp
Line:  5224
Expression:  m_pFeatureSymbol != NULL
Message:  [Jason] No feature symbol.

----------------------------------------------------------

It occurs on some other lines in CvPlot.cpp as well, around the same area. But it doesn't seem to be a problem.

Then the game loads. I begin my first turn (as the First Federation)...

Then I receive this message when going to the next turn:

Code:
Assert Failed

File:  CvCity.cpp
Line:  1013
Expression:  iCount == getBaseYieldRate((YieldTypes)iI)
Message:  

----------------------------------------------------------

This one I suspect is related to the way Star Trek overrides city yields in Python. No crashes; the game plays on.

(While this is completely unrelated, I just noticed that when in the "What would you like to build in this Star System" popup, my Deep Space Probe's unique button graphic displays correctly, but when I click "Examine Star System", it appears like the normal Scout. Probably a FF engine bug, one that I'll look into for Final Frontier Plus, but I thought I'd mention it.)

Then, on turn 32... I get an unhandled exception. (Which would be a CTD had I not been running the game attached to VC++).

The problem appears to be related to cloak code. The exception is occuring when this function (CvUnit.cpp, line 8615):

Code:
bool CvUnit::checkCloakedPlot(CvPlot* pPlot, TeamTypes eTeam) const
{
	for (int i = 0; i < pPlot->getNumUnits(); i++)
	{
		CvUnit* pUnit = pPlot->getUnitByIndex(i);
		if(pUnit->m_iSeeCloakedCount > 0)
		{
			PlayerTypes ePlayer = pUnit->getOwner();
			if(GET_PLAYER(ePlayer).getTeam() == eTeam)
			{
				return true;
			}
		}
	}

	return false;
}

Is trying to get the number of units on a plot.

That points to this function (CvPlot.cpp, line 8029):

Code:
int CvPlot::getNumUnits() const
{
	return m_units.getLength();
}

Which pulls up this function in LinkedList.h, line 65:

Code:
	int getLength() const
	{
		return m_iLength;
	}

The nature of the errors in the debugger suggest that the checkCloakedPlot function is referencing an invalid plot (as some of the plot data "cannot be evaluated"). So the actual problem may be in this function (CvUnit.cpp line 8357, which is the highlighted line):

Code:
bool CvUnit::isInvisible(TeamTypes eTeam, bool bDebug, bool bCheckCargo) const
{
	if (bDebug && GC.getGameINLINE().isDebugMode())
	{
		return false;
	}

	if (getTeam() == eTeam)
	{
		return false;
	}

	if (alwaysInvisible())
	{
		return true;
	}

	if (bCheckCargo && isCargo())
	{
		return true;
	}

	bool bUndetected = true;
	for(int i = 0; i < 3; i++)
	{
		for(int j = 0; j < 3; j++)
		{
			[COLOR="Red"]if(checkCloakedPlot(GC.getMap().plot((plot()->getX() - 1 + i),(plot()->getY() - 1 + j)), eTeam))[/COLOR]
			{
				bUndetected = false;
			}
		}
	}

	if (m_iCloakedCount > 0)
	{
		if(bUndetected)
		{
			return true;
		}
	}

    //Star Trek - promotions
	if (!(getNumInvisibleTypes() > 0))
	{
	    return false;
	}
	else
	{
        if (isInvisibleAtPlot(plot(), eTeam))
        {
            return true;
        }
	}

	return false;
}

Anyway, I then stop debugging and the CTD finally happens.
 
I think this is caused by the fact that the code doen't take into account map edges and wrapping. I'll try to make it work.

No idea about the other two asserts.

EDIT: Also no need to compile a debug DLL. The CvGameCoreDLL in the SDK source folder is a debug one; there's also one with asserts enabled for the scenarios in there.
 
I think this is caused by the fact that the code doen't take into account map edges and wrapping. I'll try to make it work.

Every time I play a flat map and try to go to a map edge tile, the game crashes. It did not do this in 3.00.
 
Back
Top Bottom