I'm currently trying to teach myself to mod. I've just learned how to edit and compile a DLL, and I never encounter any trouble when making simple modifications.
However, whenever I add new XML tags to XML files, things go wrong. The game crashes to desktop without a visible cause, and the only message I get is simply "Colonization has stopped working." This usually happens at the end of a turn, and it is reproducable.
I have added a new parameter (WaterExtraYield) to Civ4TraitInfos.XML, because I wanted to make a trait for natives (Fishermen) which increases the food production on water.
To do this, I looked at another parameter (ExtraYieldThresholds), which is the same kind of parameter (it also requires you to specify a yield and a number), searched for all occurences of this one in .cpp and .h files, and simply cloned all lines of code that contained "ExtraYieldThreshold" for "WaterExtraYield." I have based this more or less on this beginner's guide. I also made the necessary changes to CIV4CivilizationsSchema.xml.
But while my parameter works in exactly the same way as that other one (except obviously for the functional parts in CvPlot.cpp), it causes these mysterious crashes.
I have encountered this problem only once before, also when I tried to add an XML tag this way. Because the function of that one was completely different, it seems that this bug is caused not by an error in the code where I describe what it does, but merely by the act of adding an XML tag.
This is really annoying, as my new parameter works exactly the way I intended it to work, and the game sometimes progresses many turns in a row without any trouble, until it suddenly crashes. Does anyone know how this happens? Is there some other place where I should define the number of XML tags that a trait could have?
I would really appreciate your help on this, it would be hard to make new features if I were limited to the existing parameters in XML files.
Thanks in advance.
However, whenever I add new XML tags to XML files, things go wrong. The game crashes to desktop without a visible cause, and the only message I get is simply "Colonization has stopped working." This usually happens at the end of a turn, and it is reproducable.
I have added a new parameter (WaterExtraYield) to Civ4TraitInfos.XML, because I wanted to make a trait for natives (Fishermen) which increases the food production on water.
To do this, I looked at another parameter (ExtraYieldThresholds), which is the same kind of parameter (it also requires you to specify a yield and a number), searched for all occurences of this one in .cpp and .h files, and simply cloned all lines of code that contained "ExtraYieldThreshold" for "WaterExtraYield." I have based this more or less on this beginner's guide. I also made the necessary changes to CIV4CivilizationsSchema.xml.
But while my parameter works in exactly the same way as that other one (except obviously for the functional parts in CvPlot.cpp), it causes these mysterious crashes.
I have encountered this problem only once before, also when I tried to add an XML tag this way. Because the function of that one was completely different, it seems that this bug is caused not by an error in the code where I describe what it does, but merely by the act of adding an XML tag.
This is really annoying, as my new parameter works exactly the way I intended it to work, and the game sometimes progresses many turns in a row without any trouble, until it suddenly crashes. Does anyone know how this happens? Is there some other place where I should define the number of XML tags that a trait could have?
I would really appreciate your help on this, it would be hard to make new features if I were limited to the existing parameters in XML files.

Thanks in advance.