where are the "GC.getDefineINT" stored in SDK?

Kailric

Jack of All Trades
Joined
Mar 25, 2008
Messages
3,100
Location
Marooned, Y'isrumgone
I am simply trying to add a CivicPrereq to the Promotions XML using the FfH source code as an example. I have already done a new promotionprereq3 attribute so I learned a little bit about it but this is bugging me. One thing is I can't find where the GC.getDefineINT("MAX_CIVIC_OPTIONS") are at.

Thier 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);
        }
    }


My code:
Code:
int iI;
	if (GC.getPromotionInfo(ePromotion).getCivicPrereq() != NO_CIVIC)
		{
            for (int iI = 0; iI < GC.getDefineINT("MAX_CIVIC_OPTIONS"); iI++)
            {
               [B] if (GET_PLAYER(getOwnerINLINE()).getCivics((CivicOptionTypes)iI) != GC.getPromotionInfo(ePromotion).getCivicPrereq())[/B]
                {
                    return false;
                }
            }

        }

I keep getting a "CvUnit.cpp(11061) : warning C4101: 'iI' : unreferenced local variable" error when I compile mine.
And then a "info class incorrect" error in the Promotions XML when I load the game with my dll.

Note: My Civicprereq starts with "Civic" and theirs start with "Prereq" but my XMLs read it like I have it so there is no problem there.

Any help here?
 
One thing is I can't find where the GC.getDefineINT("MAX_CIVIC_OPTIONS") are at.

They are in GlobalDefines(Alt).xml .

One thing is I can't find where the GC.getDefineINT("MAX_CIVIC_OPTIONS") are at.

My code:
Code:
[COLOR="Red"]int iI[/COLOR];
	if (GC.getPromotionInfo([COLOR="Red"](PromotionTypes)[/COLOR]ePromotion).getCivicPrereq() != NO_CIVIC)
		{
            for ([COLOR="Red"]int[/COLOR] iI = 0; iI < GC.getDefineINT("MAX_CIVIC_OPTIONS"); iI++)
            {
               [B] if (GET_PLAYER(getOwnerINLINE()).getCivics((CivicOptionTypes)iI) != GC.getPromotionInfo([COLOR="Red"](PromotionTypes)[/COLOR]ePromotion).getCivicPrereq())[/B]
                {
                    return false;
                }
            }

        }

I keep getting a "CvUnit.cpp(11061) : warning C4101: 'iI' : unreferenced local variable" error when I compile mine.

And then a "info class incorrect" error in the Promotions XML when I load the game with my dll.

Perhaps try to remove an int reference .

If ePromotion is an int you need to add (PromotionTypes) , but it looks like getCivicPrereq() is not defined for CvPromotion (referenced for CvUnitInfo in the FFH code)

Hope this help , i'm a beginner too .

Tcho !
 
Well I can compile it now with no problems but I am still getting the "Civic_"whatever" in infoclass was incorrect" error when I load the game. If I leave the Civicprereq as NONE it loads the game just fine, and the promotion never shows up, but if I add a civic it throws up the error message and the promotion is always on no matter what.

My code now:
Code:
if (GC.getPromotionInfo(ePromotion).getCivicPrereq() != NO_CIVIC)
	{    for (int iI = 0; iI < GC.getNumCivicOptionInfos(); iI++)
         if (GET_PLAYER(getOwnerINLINE()).getCivics((CivicOptionTypes)iI) != GC.getPromotionInfo(ePromotion).getCivicPrereq())
         
         {
            return false;
         }
    }

How the hell did FfH get their code in the game and it works is all I want to know. The for (int iI = 0; iI < GC.getNumCivicOptionInfos(); iI++) is used by other Vanilla code with the getCivics((CivicOptionTypes)iI) so that should work.

I tried the suggestion also with the ((PromotionTypes)ePromotion) but same error. (GC.getPromotionInfo(ePromotion)is exactly how the rest of the Vanilla codes pulsl up the other Prereqs.
 
Back
Top Bottom