Kailric
Jack of All Trades
I am trying to get this to work for Promotions where a certain Civic allows a promotion. The code compiles but I get a "infoclass was incorrect" if I add a civic to my CivicPrereq tag in my XML... then the promotion is always on. If I leave the CivicPrereq as NONE, the promotion is not allowed, but I get no erros. Somehow I am not getting the correct type of information transfered or something.
My code:
The FfH source code has this new option for units... how do I get it to work for promotions?
Example code:
My code:
Code:
if (GC.getPromotionInfo(ePromotion).getCivicPrereq() != NO_CIVIC)
{
if (GET_PLAYER(getOwnerINLINE()).getCivics((CivicOptionTypes)6) != GC.getPromotionInfo(ePromotion).getCivicPrereq())
{
return false;
}
}
The FfH source code has this new option for units... how do I get it to work for promotions?
Example code:
Code:
//FfH Spell System: Added by Kael 07/23/2007
int iI;
CvPlot* pPlot = plot();
if (m_pUnitInfo->isAbandon())
{
bool bValid = true;
if (m_pUnitInfo->getPrereqCivic() != NO_CIVIC)
{
bValid = false;
for (int iI = 0; iI < GC.getDefineINT("MAX_CIVIC_OPTIONS"); iI++)
{
[B]if (GET_PLAYER(getOwnerINLINE()).getCivics((CivicOptionTypes)iI) == m_pUnitInfo->getPrereqCivic())[/B]
{
bValid = true;
}
}
if (GET_PLAYER(getOwnerINLINE()).isAnarchy())
{
bValid = true;
}
}
if (bValid == true)
{
if (m_pUnitInfo->getStateReligion() != NO_RELIGION)
{
bValid = false;
if (GET_PLAYER(getOwnerINLINE()).getStateReligion() == m_pUnitInfo->getStateReligion())
{
bValid = true;
}
}
}
if (bValid == false)
{
gDLL->getInterfaceIFace()->addMessage((PlayerTypes)getOwnerINLINE(), true, GC.getDefineINT("EVENT_MESSAGE_TIME"), gDLL->getText("TXT_KEY_MESSAGE_UNIT_ABANDON", getNameKey()), GC.getEraInfo(GC.getGameINLINE().getCurrentEra()).getAudioUnitDefeatScript(), MESSAGE_TYPE_INFO, m_pUnitInfo->getButton(), (ColorTypes)GC.getInfoTypeForString("COLOR_RED"), plot()->getX_INLINE(), plot()->getY_INLINE());
kill(true);
}
}