SDK Compile error

OrionVeteran

Deity
Joined
Dec 25, 2003
Messages
2,443
Location
Newport News VA
I received the following SDK error, when compiling my new DLL. I did make any changes to the file CvXMLLoadUtility.cpp, but did make changes in the CvXMLLoadUtility.h and CvXMLLoadUtilitySet.cpp files. Any ideas?


Code:
1>CvXMLLoadUtility.cpp
1>CvXMLLoadUtility.cpp(180) : error C2668: 'CvXMLLoadUtility::LoadGlobalClassInfo' : ambiguous call to overloaded function
1>        c:\SDK\CvGameCoreDLL\CvXMLLoadUtility.h(379): could be 'void CvXMLLoadUtility::LoadGlobalClassInfo<CvEffectInfo>(std::vector<_Ty> &,const char *,const char *,const char *,bool,CvCacheObject *(__thiscall CvDLLUtilityIFaceBase::* )(const TCHAR *))'
1>        with
1>        [
1>            _Ty=CvEffectInfo *
1>        ]
1>        c:\SDK\CvGameCoreDLL\CvXMLLoadUtility.h(365): or       'void CvXMLLoadUtility::LoadGlobalClassInfo<CvEffectInfo>(std::vector<_Ty> &,const char *,const char *,const char *,bool,CvCacheObject *(__thiscall CvDLLUtilityIFaceBase::* )(const TCHAR *),bool)'
1>        with
1>        [
1>            _Ty=CvEffectInfo *
1>        ]
1>        while trying to match the argument list '(std::vector<_Ty>, const char [16], const char [5], const char [39], bool, bool)'
1>        with
1>        [
1>            _Ty=CvEffectInfo *
1>        ]
1>NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual C++ Toolkit 2003/bin/cl.exe"' : return code '0x2'
1>Stop.
 
Kind of hard to say without knowing what your code changes were. But the error is saying you are calling a function, and there is more than one possible function. The compiler can't figure out which one you meant. Did you add a new function in CvXMLLoadUtility.h?
 
It looks like you need to add some of your changes to LoadGlobalClassInfo, but I'm not really great at this yet.
 
Thanks for the replies. I found one line that I forgot to comment out. So now the DLL compiles, but the mod fails to prevent the construction of a building that requires the Slavery Civic. I know this can easily be done in python. My goal is to migrate the python callback function to the SDK. Hence why I am doing this. The mod I am trying to add is the Building Civic Prereqs mod, by TheLopez:
http://forums.civfanatics.com/showthread.php?t=172405

If anyone cares to check my SDK work, here is the attachment:
 

Attachments

but the mod fails to prevent the construction of a building that requires the Slavery Civic.

Seems like the best way would be to add an XML tag to Buildinginfos such as <PrereqCivic>. Then make sure the DLL recognizes that XML tag and then check it during the canConstruct check in CvPlayer.cpp like this.

Code:
if (GC.getBuildingInfo(eBuilding).getPrereqCivic() != NO_CIVIC)
{
    bool bValid = false;
    for (iI = 0; iI < GC.getDefineINT("MAX_CIVIC_OPTIONS"); iI++)
    {
        if (getCivics((CivicOptionTypes)iI) == GC.getBuildingInfo(eBuilding).getPrereqCivic())
        {
            bValid = true;
        }
    }
    if (bValid == false)
    {
        return false;
    }
 
Seems like the best way would be to add an XML tag to Buildinginfos such as <PrereqCivic>. Then make sure the DLL recognizes that XML tag and then check it during the canConstruct check in CvPlayer.cpp like this.

Code:
if (GC.getBuildingInfo(eBuilding).getPrereqCivic() != NO_CIVIC)
{
    bool bValid = false;
    for (iI = 0; iI < GC.getDefineINT("MAX_CIVIC_OPTIONS"); iI++)
    {
        if (getCivics((CivicOptionTypes)iI) == GC.getBuildingInfo(eBuilding).getPrereqCivic())
        {
            bValid = true;
        }
    }
    if (bValid == false)
    {
        return false;
    }

What do I do if I want to add an option to allow more than one prerequisite Civic (i.e. adding the "Or" tag)? Note: Please forgive me. When it comes to the SDK, I am, for the most part, just a "script kiddie". So I really need concrete examples for all required SDK entries and or file changes to insure it works. :please:
 
What do I do if I want to add an option to allow more than one prerequisite Civic (i.e. adding the "Or" tag)?

My example code would handle an 'OR' prerequisite. Though I'm not entirely sure how to setup the XML/DLL to handle multiple entries. I guess you could just try and mimic the way its done for other multiple prereqs.

Are you wanting the building to require two civics?
 
My example code would handle an 'OR' prerequisite. Though I'm not entirely sure how to setup the XML/DLL to handle multiple entries. I guess you could just try and mimic the way its done for other multiple prereqs.

Are you wanting the building to require two civics?

Yes. I need the National Slave Auction Wonder to require the Slavery Civic or the Serfdom Civic.
 
Yep, you'll need a <CivicPrereqOR1> and <CivicPrereqOR2> or some similarly named pair of tags, then using the same approach as Tholal used in his example code, just check for either or as you loop through the civic options. The hardest part is adding the tags, and not because adding a tag is hard, just because it's tedious.
 
Back
Top Bottom