Causing me great pain...The XML tag story continues...

TRN2

Chieftain
Joined
Jan 24, 2007
Messages
89
I got in contact with Dale earlier tonight, a highly experienced modder with Civ IV, and got him to go over my custom XML tag code, and he found it to be flawless in his opinion.
He suggested I get in contact with Impaler[WrG], someone who has made several custom XML tags in the past.
Anyhow myself and Impaler have spent the past 3 hours working on this, writing a new XML tag from scratch, and he also can't see what the problem is, but will go over it again in the morning.

As far as I can see there is nothing wrong with any of what I am doing, or have been doing, but the moment I add the
Code:
//	pXML->GetChildXmlValByName(&m_iFaction,"iFaction");		//Faction Mod by TRN2 & Impaler
line to the source code, and uncomment, compile and copy to the Assets directory I get the Would you like to send an error report to Microsoft error.

The log reads
[91639.015] Loading XML file XML\GameInfo/CIV4PlayerOptionInfos.xml
[91639.062] Load XML file XML\GameInfo/CIV4PlayerOptionInfos.xml SUCCEEDED
[91639.062] SetGlobalClassInfo (Civ4PlayerOptionInfos/PlayerOptionInfos/PlayerOptionInfo)
[91639.062] Loading XML file XML\GameInfo/CIV4GraphicOptionInfos.xml
[91639.078] Load XML file XML\GameInfo/CIV4GraphicOptionInfos.xml SUCCEEDED
[91639.078] SetGlobalClassInfo (Civ4GraphicOptionInfos/GraphicOptionInfos/GraphicOptionInfo)
That is the entire xml.log file, indicating a very early crash, considering we are entering our tag in the leaderheadsinfos.
I would like to here any ideas on what could becausing this, because I have been at this problem since I arrived here about 6 days ago...
 
Link up the SDK files you have changed, your leaderhead file, and your civilization schema and I will take a look.
 
There was no leader file in your zip.
 
we hadn't gotten as far as making a leader file, becuase the element in the schema reads minOccurs="0".
I will just say that I have tried including the data before and get the exact same error in the xml.log.
I am begining to think that it might be something else...
If you would like me to make a leader file let me know, and I will.
 
Let me know if the attached files work for you.
 

Attachments

I am compiling it now - I noticed the only differences I saw were the locations of the read/writes from the bottom up to much earlier in the file, was there anything else done (still havn't tested it to work yet)
 
Ok, so this time it works, what had we done wrong, so I cando this in future?
 
As you noticed, I just put the order the attributes are read in the cpp into the same order they are stored in xml. The only change I think really matter is the move of the "pXML->GetChildXmlValByName(&m_iFaction,"iFaction"); //Faction Mod by TRN2 & Impaler" line.
 
I will in future keep all the entries on the same lines, as I did in the past (dunno, just dunno), I got some additional questions, even though I won't do it this way because it works the way you say.
Can the read and write (not the pXML read) be on a different line than the pXML read, so long as the read and write are in the same spots, I know this don't make to much sense, but for example, you said...
The only change I think really matter is the move of the "pXML->GetChildXmlValByName(&m_iFaction,"iFaction"); //Faction Mod by TRN2 & Impaler" line.
What I am trying to know, is would this still theoretically work if you had only moved that one line? because in my short experience I am not sure it does for me!
EDIT: Also thanks a lot Kael, I been going really mental here trying to work this out for days, I had a very few successes first times around, then all of a sudden it just stopped working for me :( was enough to make me scream a few times, but provided I can get this working, I think I'll get over it ;)
 
I will in future keep all the entries on the same lines, as I did in the past (dunno, just dunno), I got some additional questions, even though I won't do it this way because it works the way you say.
Can the read and write (not the pXML read) be on a different line than the pXML read, so long as the read and write are in the same spots, I know this don't make to much sense, but for example, you said...

What I am trying to know, is would this still theoretically work if you had only moved that one line? because in my short experience I am not sure it does for me!
EDIT: Also thanks a lot Kael, I been going really mental here trying to work this out for days, I had a very few successes first times around, then all of a sudden it just stopped working for me :( was enough to make me scream a few times, but provided I can get this working, I think I'll get over it ;)

I didnt run any builds with the other lines in the origional locations, so I dont know for sure but I think the pXML read line is the only one that matters. I would guess that you could put all the other ones back and it would work. But Im a "find one way that works and stick with it" sort of person so I moved them all to the locations I typically use.
 
Are you talking about the stream->Read/Write lines?
Those have nothing to do with the xml files. They are for storing information in save games. You are free to arrange this in any order you want.
But I would always use the same order, because it's more suggestive.

Matze
 
Those have nothing to do with the xml files. They are for storing information in save games. You are free to arrange this in any order you want.
tbh I am a bit lost on this - and there seems to be some debate - some people say it is for saved games, others say it is to do with the caching function.
From what I can see it is to do with the caching function, since most of what these read/write bits seem to send is not in the saved game, but to do specifically with the xml, and hence the need to have the mod installed when the game loads...
 
No, we are talking about the line:

Code:
	pXML->GetChildXmlValByName(&m_iFaction,"iFaction");		//Faction Mod by TRN2 & Impaler

That is used to read the value from xml.

The lines you mentioned:

Code:
	stream->Read(&m_iFaction);					//Faction Mod by TRN2 & Impaler

or:

Code:
	stream->Write(m_iFaction);  //Faction Mod by TRN2 & Impaler

Are used to save and read data and I don't believe their order matters (as long as they match each other).
 
The stream read/write are used to make/read cache data, not save game data.

I know the getChild element dosen't require perfect order, I put them at the bottom of the function but have the tags sprinkled throughout the file, perhaps so long as it preceeds its ok
 
On the game object such as CvCity and CvUnit thats true, its the objects on CvInfo that are cached, they dont go in the save, thats why changing the values in your Assets will alter a saved game and theirs that warning about a save being under a particular mod to keep you from screwing things up as thouse read functions will crash or lock when feed the wrong data.
 
Back
Top Bottom