CTD Help Needed

deanej

Deity
Joined
Apr 8, 2006
Messages
4,859
Location
New York State
I'm having CTD problems with my Star Trek mod again. In the Deep Space Nine scenario, a CTD happens when the Breen enter the war. I have little idea what causes it; I only know that the following assert messages occur (in addition to a bunch that I've verified as seemingly harmless):

Spoiler :
Assert Failed

File: CvTeam.cpp
Line: 1835
Expression: !(AI_isSneakAttackPreparing((TeamTypes)iI))
Message:

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



Assert Failed

File: CvGlobals.cpp
Line: 3493
Expression: strcmp(szType, "NONE")==0 || strcmp(szType, "")==0
Message: info type UNIT_GALOR not found, Current XML file is: xml\GameInfo/CIV4EspionageMissionInfo.xml

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

Note: I also get similar messages about the Keldon and Hideki in addition to the Galor. Why would all the Cardassian units become linked to Civ4EspionageMissionInfo?


Assert Failed

File: CvPlayer.cpp
Line: 2122
Expression: eUnit != NO_UNIT
Message: Unit is not assigned a valid value

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


Assert Failed

File: CvUnit.cpp
Line: 91
Expression: NO_UNIT != eUnit
Message:

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


I think the problem is related to the last two, but I have no clue as to why. The war declaration method in the python used here is almost identical to the ones used for the other powers entering the war. There's a save here; just hit end turn and you should get the crash after a very long wait. The link to the mod is in my sig.

Also, on an unrelated note, do you have any idea how I can make it so that when the leader of a civ changes, the name changes as well? Currently the name won't change if the leader name is stored in a scenario file (easy to work around) or if the game was loaded from a save.
 
File: CvGlobals.cpp
Line: 3493
Expression: strcmp(szType, "NONE")==0 || strcmp(szType, "")==0
Message: info type UNIT_GALOR not found, Current XML file is: xml\GameInfo/CIV4EspionageMissionInfo.xml

This one looks like an XML error. Perhaps UNIT_GALOR ir referenced in the Wrong place somehow ?
 
I can't find an incorrect mention anywhere in the XML. But does anyone know why the mod is crashing? I've tried everything I can think of - moving where the new Breen units spawn, changing some variable names, removing the unit spawn completely. None of it works. I don't get it. I can't see any difference between this war declaration and another. Are AI-only civs not supposed to be able to enter wars via python? I need help!

Could it be a memory leak? The mod is very slow (huge map, lots of civs, large war, lots of cities, many units, lots of python).
 
There should be no principal obstracle to make a Civ - AI or not - enter War via Python. Memory leak - while allways a possibility i.g. - is very-very unlikely to strike at exactly the same, well defined point of time.

At any rate - just changing some random stuff - like shifting unit locations or time of events - won't get you far, as it is not what the error information at hand does point you to. If anything at all, it supports that this is not a 'random' out of memory crash.

So, what i was trying to tell is, that the XML error likely is why the mod is crashing. The messages you quoted do clearly suggest that UNIT_GALOR is referenced at some point, without being defined / not making sense in the specific context. (Note, that if you hardcoded lots of stuff in Python or SDK, the bad reference might also be there somewhere).
It might be not - or not the only - cause of the crash or you might be wrong about the "bunch of seemingly harmless messages" being irrelevant. But you can only make one step at a time. You suspect these messages to be relevant - process them, find and remove the cause. If it doesn't sort out the issue, you go on to the next error message, until you got it sorted out.

No one is more familiar with the code than you are, so you are the one with the best chance to find it.
 
So it seems in UnitInfos you call the Cardasian Ships UNIT_CARDGALOR etc. Meaning the UNIT_GALOR type is not defined at all. Yet it is referenced in CVFinalFrontierEvents.py
Code:
        def doCardassianResistance(self):
            iLeader = gc.getInfoTypeForString("LEADER_BROCA")
            gc.getPlayer(3).changeLeader(iLeader)#5 Keldon, 3 Galor, 2 Hideki (Federation Hidden Nationality)

            pFederation = gc.getPlayer(0)
            iGalor = gc.getInfoTypeForString("UNIT_GALOR")
            iKeldon = gc.getInfoTypeForString("UNIT_KELDON")
            iHideki = gc.getInfoTypeForString("UNIT_HIDEKI")
            pPlot = CyMap().plot(49, 37)
This is most likely what is causing the message you quoted. There are also the UNIT_KELDON and UNIT_HIDEKI you mentioned throwing similar errors.
I don't know why it is linked to Breen entering the war... Does Cardassian Resistance spawn at the same time by any chance ?
 
They do happen at the same time. That fixed the CTD. Thanks a lot! I would have thought that they would have caused a python exception instead of a CTD so I never checked the python.

As for the asserts, many of them are tied to the Assimilation mod. Most of my SDK code is from pieces of the Assimilation mod (the game option; have not updated to latest version), the Conqueror's Delight mod (some promotion code for the cloaking device), and the Revolution mod (the leader changing code used only in DS9). In addition to that I changed the animals to be able to enter cultural borders even with the "Great Wall" (Border Defense Network). These asserts have never caused issue (at least when running Windows XP; Vista is less forgiving and had a CTD with one in a different scenario).
 
There wasn't any reference (not even a definition :lol:) to UNI_GALOR in the XML files i had expected it to be in, but the thing must have been coming from somewhere... So i just run a search for it through all the files and found these Python references.
 
Could I ask how you searched all the files? I don't know of any way of doing it without opening each file individually and running search in either python or wordpad based on what type of file it its (very inconvenient). I guess the lack of a python exception for that problem is why Firaxis uses stuff like

iDestroyerIV = CvUtil.findInfoTypeNum(gc.getUnitInfo,gc.getNumUnitInfos(),'UNIT_LIGHT_V')

instead of

iGalor = gc.getInfoTypeForString("UNIT_GALOR")

Hopefully that will solve all of DS9's issues. This scenario has to deal with the fact that it was the first I made for Star Trek, and hence had (or maybe still has... never had time to test it fully due to the long turn length) many issues. Now I have enough experience with the process that I can make one in a weekend if I have time, but DS9 took a month (and longer to work out all the bugs).

BTW, do you (or anyone else reading this) have any advice on the leader names issue (such as a way to have the game assign the proper name in the XML over the one in the save game when the game is loaded) or to speed it up?
 
Could I ask how you searched all the files? I don't know of any way of doing it without opening each file individually and running search in either python or wordpad based on what type of file it its (very inconvenient).
That sounds painful indeed. Curious how one must look for the most basic tools on a 'standard' Windows PC... :rolleyes:
I use grep - it's a Unix/Linux tool, but there are various windows ports (my is part of the MSYS Gcc Environment) - very handy, if you happen to need that kind of thing.
I never looked, because i am used to my toolset, but i suspect, that the new fancy multi-tab editors like Notepad++, Codeblocks, and the IDEs shipping with Visual C++ or Python should have the ability to do it too...
 
Top Bottom