Afforess
The White Wizard
I've been trying to add some new arrays to CvInfos, but have been having a more difficult time than usual, because the arrays are very different from what I'm used to.
See, I'm trying to clone and add several new arrays based on CvImprovementInfos::TechYieldchanges(); array. It appears to me that this array is really an array of an array. Regardless, I'm trying to move this array over to CvBuildingInfos, and add three similar arrays, TechHappinessChanges, TechHealthChanges, and TechCommerceChanges. I seemed to do fine just cloning TechYieldChanges, and then adapting it for TechCommerChanges. Where I really have problems is TechHappinessChanges and TechHealthChanges.
I'm fairly sure I'm doing this wrong, so that's why I'm asking for help.
Okay, here's a spot where I am confused on what to do:
This code is correct
This code is incorrect, but I'm not sure how to fix it. What do I use instead of NUM_YIELD_TYPES?
Personally, I'm thinking that the Commerce and Yield changes are array's of arrays, but the happiness and healthiness are not, and I should do those like I do every other array. Am I correct, or way off base?
See, I'm trying to clone and add several new arrays based on CvImprovementInfos::TechYieldchanges(); array. It appears to me that this array is really an array of an array. Regardless, I'm trying to move this array over to CvBuildingInfos, and add three similar arrays, TechHappinessChanges, TechHealthChanges, and TechCommerceChanges. I seemed to do fine just cloning TechYieldChanges, and then adapting it for TechCommerChanges. Where I really have problems is TechHappinessChanges and TechHealthChanges.
I'm fairly sure I'm doing this wrong, so that's why I'm asking for help.
Okay, here's a spot where I am confused on what to do:
This code is correct
Code:
int CvBuildingInfo::getTechCommerceChanges(int i, int j) const
{
FAssertMsg(i < GC.getNumTechInfos(), "Index out of bounds");
FAssertMsg(i > -1, "Index out of bounds");
FAssertMsg(j < NUM_COMMERCE_TYPES, "Index out of bounds");
FAssertMsg(j > -1, "Index out of bounds");
return m_ppiTechCommerceChanges[i][j];
}
int* CvBuildingInfo::getTechCommerceChangesArray(int i)
{
return m_ppiTechCommerceChanges[i];
}
This code is incorrect, but I'm not sure how to fix it. What do I use instead of NUM_YIELD_TYPES?
Code:
int CvBuildingInfo::getTechHealthChanges(int i, int j) const
{
FAssertMsg(i < GC.getNumTechInfos(), "Index out of bounds");
FAssertMsg(i > -1, "Index out of bounds");
// FAssertMsg(j < NUM_YIELD_TYPES, "Index out of bounds");
// FAssertMsg(j > -1, "Index out of bounds");
return m_ppiTechHealthChanges[i][j];
}
int* CvBuildingInfo::getTechHealthChangesArray(int i)
{
return m_ppiTechHealthChanges[i];
}
Personally, I'm thinking that the Commerce and Yield changes are array's of arrays, but the happiness and healthiness are not, and I should do those like I do every other array. Am I correct, or way off base?