I'm working essentially off the following example in the existing code:
This is from the CvInfos.cpp entry for the CvCivicInfo, because the ImprovementYieldChanges stuff is similar to what I'm trying to do.
The hang-up I'm having is figuring out what value I should use for the array I've created in place of the "GC.getNumImprovementInfos()" component. I need to figure out the index of the last entry in this array.
I have a sneaking suspicion (from tracing GC.getNumImprovementInfos) that I'm going to have to add functions to keep count wherever the game reads in the XML, but I'm not really sure how I would go about doing that, because I couldn't really follow the code where the getNumImprovementInfos function does its work.
And for the true coders who read this, yes, my knowledge of C++ really is so uneven that I can get this far without knowing the answer to this.
Code:
if (m_ppiImprovementYieldChanges != NULL)
{
for (iI=0;iI<GC.getNumImprovementInfos();iI++)
{
SAFE_DELETE_ARRAY(m_ppiImprovementYieldChanges[iI]);
}
SAFE_DELETE_ARRAY(m_ppiImprovementYieldChanges);
}
This is from the CvInfos.cpp entry for the CvCivicInfo, because the ImprovementYieldChanges stuff is similar to what I'm trying to do.
The hang-up I'm having is figuring out what value I should use for the array I've created in place of the "GC.getNumImprovementInfos()" component. I need to figure out the index of the last entry in this array.
I have a sneaking suspicion (from tracing GC.getNumImprovementInfos) that I'm going to have to add functions to keep count wherever the game reads in the XML, but I'm not really sure how I would go about doing that, because I couldn't really follow the code where the getNumImprovementInfos function does its work.
And for the true coders who read this, yes, my knowledge of C++ really is so uneven that I can get this far without knowing the answer to this.