Civic Attitude Modifier

There are two lines that look like this:

Code:
if ([B]gDLL->getXMLIFace()[/B]->SkipToNextVal())

Change them to this:

Code:
if ([B]pXML[/B]->SkipToNextVal())

Remove any code you had added previously to CvCivicInfo::read() as we're doing all the reading in readpass2().
 
I have one error left, and one warning. Here they are:

CvInfos.cpp(8439) : error C3861: 'FindInInfoClass': identifier not found, even with argument-dependent lookup
CvInfos.cpp(8602) : warning C4805: '==' : unsafe mix of type 'int' and type 'bool' in operation

The warning has to do with this code:
Code:
	for ( int i = 0; i < GC.getNumCivicInfos(); i++ )
	{
		if ( m_piCivicAttitudeChanges[i] == bDefault )
		{
			m_piCivicAttitudeChanges[i] = pClassInfo->getCivicAttitudeChanges(i);
		}
	}
 
For the first, put "pXML->" in front of the FindInInfoClass() call. Can you post the context for the second error? Perhaps it's caused by the first error.
 
I updated my earlier post. Now, I get even more errors with that. Heres the offending lines of code
Code:
						{
							int iCivicType = "(pXML->FindInInfoClass(szCivicKey));
							if (iCivicType >= 0)
							{

and the errors related to it.

CvInfos.cpp(8439) : error C2001: newline in constant
CvInfos.cpp(8440) : error C2440: 'initializing' : cannot convert from 'const char [37]' to 'int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
CvInfos.cpp(8440) : error C2143: syntax error : missing ';' before 'if'
 
Where did that code with pClassInfo in it come from?

Perhaps change the line with TCHAR in it to

Code:
[B]CvString[/B] szCivicKey;

Looking at the original code, each function does it slightly differently. Can you post your latest CvInfos.cpp file?
 
You have a typo in the code I posted. On this line

Code:
int iCivicType = "(pXML->FindInInfoClass(szCivicKey));

remove the " and extra () pair:

Code:
int iCivicType = pXML->FindInInfoClass(szCivicKey);
 
Okay, I fixed that, but now I have a new error, it has to do with the readpass 2.
error C4716: 'CvCivicInfo::readPass2' : must return a value
 
I still get that warning about unsafe mixtures of integers and boolean, but it compiles. I just hope it gets past CvPlayerAI
 
Okay, after messing with some header files, I believe everything I have right now compiles. I don't know if it works, but it does compile.
 
Looks like I spoke too soon. As soon as codeblocks trys to link all the files together, at the very end, I get an error.

Its mostly garbage, but here is the error.


CvXMLLoadUtilitySet.obj : error LNK2019: unresolved external symbol "public: void __thiscall CvCivicInfo::copyNonDefaultsReadPass2(class CvCivicInfo *)" (?copyNonDefaultsReadPass2@CvCivicInfo@@QAEXPAV1@@Z) referenced in function "private: void __thiscall CvXMLLoadUtility::SetGlobalClassInfoTwoPassReplacement<class CvCivicInfo>(class std::vector<class CvCivicInfo *,class std::allocator<class CvCivicInfo *> > &,char const *)" (??$SetGlobalClassInfoTwoPassReplacement@VCvCivicInfo@@@CvXMLLoadUtility@@AAEXAAV?$vector@PAVCvCivicInfo@@V?$allocator@PAVCvCivicInfo@@@std@@@std@@PBD@Z)
Assets\CvGameCoreDLL.dll : fatal error LNK1120: 1 unresolved externals
 
The Infos.cpp you posted doesn't have CvCivicInfo::copyNonDefaultsReadPass2(). Remove

Code:
void copyNonDefaultsReadPass2(CvCivicInfo* pClassInfo = NULL); //Afforess

from the header file.

This isn't an error, but it is misleading. The function to access a single modifier is plural. Typically you would make this singular:

Code:
int getCivicAttitudeChange[s]s[/s](int i) const;

However, I would get it working before messing with that.
 
Okay, I compiled the DLL, however I am unsure how the Schema should be changed. Something like this maybe?
Code:
	<ElementType name="CivicAttitudeChanges" content="eltOnly"> 
		<element type="iCivicAttitudeChanges" minOccurs="0" maxOccurs="*"/>
	</ElementType>

Or am I way off?
 
I'm patterning this off of <BonusTypeStructs> from CvImprovementInfo.

Code:
	<ElementType name="CivicType" content="textOnly"/>
	<ElementType name="iAttitudeChange" content="textOnly" dt:type="int"/>
	<ElementType name="CivicAttitudeChange" content="eltOnly">
		<element type="CivicType"/>
		<element type="iAttitudeChange"/>
		<!--element type="Description"/-->
	</ElementType>
	<ElementType name="CivicAttitudeChanges" content="eltOnly">
		<element type="CivicAttitudeChange" maxOccurs="*"/>
	</ElementType>

Here's an example of this layout:

Code:
<CivicAttitudeChanges>
	<CivicAttitudeChange>
		<CivicType>CIVIC_EMANCIPATION</CivicType>
		<iAttitudeChange>-2</iAttitudeChange>
		<Description>%D1: Whip it!</Description>
	</CivicAttitudeChange>
</CivicAttitudeChanges>
 
With those Schema changes I get LoadXML errors when I try to start the game, then a CTD.
 
What's your XML look like for one of the civics?

And does anything show in the logs?

Oh, notice that I have the Description element commented out in the schema, so make sure you don't specify one in your XML.
 
Yeah, the XML log shows some things failed to load. I won't post all the success, but I did post all the fails.
[255466.067] Load XML file modules\Custom Leaderheads\MLF_CIV4ModularLoadingControls.xml SUCCEEDED
[255466.067] Loading XML file modules\Holy Wars\MLF_CIV4ModularLoadingControls.xml
[255466.067] Load XML file modules\Holy Wars\MLF_CIV4ModularLoadingControls.xml SUCCEEDED
[255466.067] Loading XML file modules\Jooyo\MLF_CIV4ModularLoadingControls.xml
[255466.067] Load XML file modules\Jooyo\MLF_CIV4ModularLoadingControls.xml SUCCEEDED
[255466.114] Loading XML file xml\GameInfo/CIV4PlayerOptionInfos.xml
[255469.265] Load XML file xml\GameInfo/CIV4PlayerOptionInfos.xml FAILED
[255470.575] Loading XML file xml\GameInfo/CIV4GraphicOptionInfos.xml
[255471.730] Load XML file xml\GameInfo/CIV4GraphicOptionInfos.xml FAILED
 
But those have nothing to do with civics, do they? Have you been making other changes to those areas?
 
Nope, but they use the same Schema. Just to test, I removed all the lines I added from the schema, and it loaded with no errors. (Well, except for the errors that Civicinfos gives when you don't declare something in the schema...)
 
Back
Top Bottom