davidlallen
Deity
I am trying to add a feature where certain civilizations are forbidden from founding or converting to certain religions. There is a python hook to prevent founding, via doHolyCity / doHolycityTech, but there is no python hook to prevent converting.
I have hard-coded a new function CvReligionInfo::isForbidden(eCivilizationType) and put calls to this function all the places it needs to go, and it is working. However, it has to be driven by xml. So I have added schema and sdk code for this, in gameinfo/civ4religioninfo.xml:
However, this does not work, because when reading the xml, it calls GC.getNumCivilizationInfos(), which returns 0. Then the code tries to allocate 0 bytes and throws an xml parsing error.
This implies that I cannot put civilization infos onto religions, because the xml from assets/gameinfo is read before the xml from assets/civilizations. If that is true, then I can rewrite the code to be like CvCivilizationInfo::isForbidden(eReligionType) and put the xml into the civilization xml, listing the religions inside.
Is that correct? If so, is there a canonical list of the order in which directories are read, so that I can avoid this mistake in the future?
I have hard-coded a new function CvReligionInfo::isForbidden(eCivilizationType) and put calls to this function all the places it needs to go, and it is working. However, it has to be driven by xml. So I have added schema and sdk code for this, in gameinfo/civ4religioninfo.xml:
Code:
<ForbiddenCivs>
<ForbiddenCiv>
<CivName>CIVILIZATION_FOO</CivName>
<bForbidden>1</bForbidden>
</ForbiddenCiv>
<ForbiddenCiv>
<CivName>CIVILIZATION_BAR</CivName>
<bForbidden>1</bForbidden>
</ForbiddenCiv>
</ForbiddenCivs>
However, this does not work, because when reading the xml, it calls GC.getNumCivilizationInfos(), which returns 0. Then the code tries to allocate 0 bytes and throws an xml parsing error.
This implies that I cannot put civilization infos onto religions, because the xml from assets/gameinfo is read before the xml from assets/civilizations. If that is true, then I can rewrite the code to be like CvCivilizationInfo::isForbidden(eReligionType) and put the xml into the civilization xml, listing the religions inside.
Is that correct? If so, is there a canonical list of the order in which directories are read, so that I can avoid this mistake in the future?