Help with ranged bombard promotions

Well it's the only new thing I added to the dll. I'll try going back to an older dll.
 
I get weird behaviour on my 64 bit Windows 7, with nearly all games crashing within 25 turns. I am able to play on an XP machine without issues. I have a debug dll, that works, but I'm not getting any meaningful information from those crashes yet. Mostly Access Violations. :confused:

An access violation in one place can cause a crash in another place. Do you get the same access violations using a debug dll which does *not* have your changes? If your changes are introducing access violations, this can definitely be the reason.
 
Thanks for chiming in... I just built a debug dll with the accuracy promo rolled back - and it gives me the exact same issues. What is even more strange, I also tried using the previous, well working version of my dll with the new xml. Still crashes. Adding a new attribute to the xml, and then completely ignoring it in the dll should not cause any crashes, should it? There are no python changes in the new version - it is strictly xml and dll changes. I'm stumped.
 
Let's try the easy stuff first. Are you sure there are no undefined items in the new xml? I recommend civcheck to look for this. Items which are used but not defined in the xml can cause unexpected crashes. At any rate, I suggest you keep rolling back changes which ""should not have caused any problems"" until the problem stops happening, then add them one at a time.
 
Thanks for the pointers. I've had a busy weekend, but I'll be sure to try out civchecker this week.

Are you sure there are no undefined items in the new xml? I recommend civcheck to look for this. Items which are used but not defined in the xml can cause unexpected crashes.

It's the other way around. :) I have removed all references to the new xml fields from the dll, but they're still there in the xml.

Also have you tried running your mod with old working dll and without the xml changes?

That would be... like using the old version of the mod I guess. Yes, that works perfectly. :)
 
This is the result from Civchecker:
Edit E:/Privat/Civchecker/civcheck.config and then use File=>Run
Status: loaded 5045 art files from cache, 0 duplicate
Status: total art load time 0 seconds
SUMMARY: 0 missing art files
SUMMARY: 0 undefined symbols found
SUMMARY: 0 symbols defined
SUMMARY: 0 unreferenced symbols found
Status: Results written to E:/Privat/Civchecker/civcheck.txt

I guess that means the XML is okay?
 
Okay, this is what I have added for the Accuracy promotion to the source code. Please help me check it, especially to check if anything is missing: :)

Spoiler :
1. From CvUnit.h:
Code:
	void setDCMBombAccuracy(int iNewValue);
	void changeDCMBombAccuracy(int iChange);

2. From CvUnit.cpp:
Code:
void CvUnit::init

	setDCMBombAccuracy(GC.getUnitInfo(getUnitType()).getDCMBombAccuracy());

void CvUnit::setHasPromotion

	changeDCMBombAccuracy(GC.getPromotionInfo(eIndex).getDCMBombAccuracyChange() * iChange);

[B]and finally[/B]
//Accuracy Promotion Start - Ninja2
/*Original code start
int CvUnit::getDCMBombAccuracy() const
{
	return GC.getUnitInfo(getUnitType()).getDCMBombAccuracy();
}
Original code end*/
int CvUnit::getDCMBombAccuracy() const
{
	return m_iDCMBombAccuracy;
}

void CvUnit::setDCMBombAccuracy(int iNewValue)
{
    m_iDCMBombAccuracy = iNewValue;   
}

void CvUnit::changeDCMBombAccuracy(int iChange)
{
    setDCMBombAccuracy(getDCMBombAccuracy() + iChange);
}
//Accuracy Promotion End - Ninja2

3. From CvInfos.h:
Code:
	int getDCMBombAccuracyChange() const;				//Exposed to Python			

	int m_iDCMBombAccuracyChange;

4. From CvInfos.cpp:
Code:
m_iDCMBombAccuracyChange(0),

int CvPromotionInfo::getDCMBombAccuracyChange() const
{
	return m_iDCMBombAccuracyChange;
}

stream->Read(&m_iDCMBombAccuracyChange);

stream->Write(m_iDCMBombAccuracyChange);

pXML->GetChildXmlValByName(&m_iDCMBombAccuracyChange, "iDCMBombAccuracyChange");
 
As expected my crash had nothing to do with this promotion. I had removed a unit from my mod, but unfortunately I forgot to remove the entry in UnitClassInfos.xml. I'm not sure if I used civchecker wrongly, but should a superflous entry have triggered an error from the civchecker?
 
Top Bottom