SDK causing XML loading error?

deadliver

Loud Mouth Amateur
Joined
Oct 18, 2003
Messages
1,508
Location
Anvilania
Okay so I want to have the Morganites in Planetfall start out with 500 gold.

in the Infos xml files I added:

<iStartingGold>500</iStartingGold>

right under the iHappiness entry for convenience.

I then added iStartingGold to the schema xml file and loaded the game, I had no problems but of course there was no 500 gold for Morgans.

THEN I looked at the SDK files CVINFOS. In there I added

in the CVTraitInfo section:

m_iStartingGold(0), under m_iHappiness

then later:

int CVTraitInfo::getStartingGold() const
{
return m_iStartingGold;
}


then this in the xmlloadingutility section:

pXML->GetChildXmlValByName(&m_iStartingGold, "iStartingGold"); (should that second Starting gold be iGold?)

Those are the changes I made in the CvInfo.cpp file. Then I made the following entries in the CVINFOs.h file:

DllExport int getStartingGold () const; // Exposed to Python this was entered under the Dllexport entry for getHappiness

....

then I entered:

int m_iStartingGold; in the protected member variables.


Now I am getting an XML loading error which says something about a call to load the TraitInfos.xml has failed?

Anyone here have any idea what I did wrong?


edit: I have found entries dealing with Traitinfo entries in some CY files too I am looking there.
 
You didn't modify TraitInfos, but it uses the same Schema file as one that you DID modify I bet. This is typically an indication that you added something to the schema which was already there (so in this case since you did only 1 variable, it is easy to figure out what you did ;))


But, you forgot to make some entries which you need to make in the SDK. In CvInfos.cpp you need to find the ->Read and ->Write functions so the game remembers to record these values loaded from the XML. Then you also have to find where in CvPlayer the starting gold is assigned. Since you are copying a field that already exists somewhere else it is nice and easy, just find where they did it (do a search in the entire SDK project for all instances of "StartingGold" and make sure that you have a "match" for almost every item which already exists for the other field, this would point out things like the ->Read ->Write which you may have forgotten)
 
Top Bottom