phungus420
Deity
- Joined
- Mar 1, 2003
- Messages
- 6,296
Currently the inquistions code that everyone seems to use hardcodes the civics in the python itself. I've moved some of that over to the XML in terms of the inquisitor trainability, which removed the need for the canTrain callback. Now I'd like to finish things up, and use the new XML in UnitInfos to define when inquisitions can be done.
Currently this is how things work:
and
These are checks to see if inquisitions can be performed. The former is a can do check (if the player is running one of these civics you can conduct inquitions), the latter is a negative check (if the player is running either of these civics inquisitions can not be performed). I'm forgoeing the rest of the code as it's not important, I'm just interested in this piece. Basically I want to take the new PrereqOrCivic code that looks like this in UnitInfos:
And use that as the check for if inquisitions can be conducted.
I have exposed this tag to python through CyInfoInterface here:
How should I begin to change this check so that it pulls the civics from the XML in unitinfos? In pseudo code I'd like it to be like this:
if ( pUnit.getPrereqOrCivics() == pUnit.getPlayer().getCivics(AnyCivic in getPrereqOrCivicArray for pUnit) )
but I do not know how to write this so it's syntatically correct. Also do I need to add the PrereqOrCivic exposure to CyUnit?
Currently this is how things work:
Code:
...
if ( ( pCityPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_RELIGION')) == gc.getInfoTypeForString('CIVIC_THEOCRACY') ) or ( pCityPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_RELIGION')) == gc.getInfoTypeForString('CIVIC_ORGANIZED_RELIGION') ) ):
...
Code:
...
if ( pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_RELIGION')) == gc.getInfoTypeForString('CIVIC_PAGANISM') or if pPlayer.getCivics(gc.getInfoTypeForString('CIVICOPTION_RELIGION')) == gc.getInfoTypeForString('CIVIC_PACIFISM') ):
...
These are checks to see if inquisitions can be performed. The former is a can do check (if the player is running one of these civics you can conduct inquitions), the latter is a negative check (if the player is running either of these civics inquisitions can not be performed). I'm forgoeing the rest of the code as it's not important, I'm just interested in this piece. Basically I want to take the new PrereqOrCivic code that looks like this in UnitInfos:
Code:
<PrereqOrCivics>
<PrereqCivic>
<CivicOption>CIVIC_THEOCRACY</CivicOption>
<bPrereqCivic>1</bPrereqCivic>
</PrereqCivic>
<PrereqCivic>
<CivicOption>CIVIC_ORGANIZED_RELIGION</CivicOption>
<bPrereqCivic>1</bPrereqCivic>
</PrereqCivic>
</PrereqOrCivics>
I have exposed this tag to python through CyInfoInterface here:
Code:
//RevolutionDCM canTrain
.def("getPrereqOrCivics", &CvUnitInfo::getPrereqOrCivics, "bool (int iCivic)")
//RevolutionDCM end
How should I begin to change this check so that it pulls the civics from the XML in unitinfos? In pseudo code I'd like it to be like this:
if ( pUnit.getPrereqOrCivics() == pUnit.getPlayer().getCivics(AnyCivic in getPrereqOrCivicArray for pUnit) )
but I do not know how to write this so it's syntatically correct. Also do I need to add the PrereqOrCivic exposure to CyUnit?