Thunderbrd
C2C War Dog
Ok, attempting your second suggestion there, I'm finding this REALLY tough but I think I've done fairly well... just a few issues here.
My initial blind and completely ignorant attempt at the Read process needs tweaking...
I get the following in regards to this section:
No idea how to correct this - just getting this far is a whole lot of guesswork.
The other section that gives me trouble is in the text manager:
I'm getting:
So apparently this is only going to evaluate a particular unit in the game if my assessments here are correct, so this really isn't going to work very well at all... perhaps better to simply list the free promotions themselves with a footnote that there could be some unexplained conditions at this time eh? Even just trying to list off the conditions themselves on each free promo would be extraordinarily taxing to the display if trying to accommodate all possible conditions.
Surprisingly I got no other errors. I'm hoping this means we're doing pretty good up to this point.
My initial blind and completely ignorant attempt at the Read process needs tweaking...
Code:
if(GETXML->SetToChildByTagName( pXML->GetXML(), "FreePromoTypes"))
{
int i = 0;
int iNum = GETXML->NumOfChildrenByTagName( pXML->GetXML(), "PromotionType" );
m_aFreePromoTypes.resize(iNum); // Important to keep the delayed resolution pointers correct
if(GETXML->SetToChild( pXML->GetXML() ))
{
if (GETXML->LocateFirstSiblingNodeByTagName(pXML->GetXML(), "PromotionType"))
{
do
{
pXML->GetChildXmlValByName(szTextVal, "PromotionType");
if (pXML->GetChildXmlValByName(&(m_aFreePromoTypes[i].m_pExprFreePromotionCondition), "FreePromotionCondition"))
{
m_aFreePromoTypes[i].m_pExprFreePromotionCondition = BoolExpr::read(pXML);
GETXML->SetToParent(pXML->GetXML());
}
GC.addDelayedResolution((int*)&(m_aFreePromoTypes[i].ePromotion), szTextVal);
i++;
} while(GETXML->LocateNextSiblingNodeByTagName(pXML->GetXML(), "PromotionType"));
}
GETXML->SetToParent( pXML->GetXML() );
}
GETXML->SetToParent( pXML->GetXML() );
}
Code:
1>CvInfos.cpp(28899) : error C2664: 'bool CvXMLLoadUtility::GetChildXmlValByName(std::string &,const TCHAR *,char *)' : cannot convert parameter 1 from 'BoolExpr ** ' to 'std::string &'
The other section that gives me trouble is in the text manager:
Code:
for (iI = 0; iI < GC.getBuildingInfo(eBuilding).getNumFreePromoTypes(); iI++)
{
BoolExpr* pExpr = GC.getBuildingInfo(eBuilding).getFreePromoType(iI).m_pExprFreePromotionCondition;
if (pExpr)
{
bool bEval = false;
if (pCity)
{
for (int iJ = 0; iJ < GC.getNumUnitInfos(); iJ++)
{
UnitTypes eUnit = ((UnitTypes)iJ);
bEval = pExpr->evaluate(const_cast<CvGameObjectUnit*>(eUnit->getGameObjectConst()));
}
}
if (!bEval)
{
szBuffer.append(NEWLINE);
szBuffer.append(gDLL->getText("TXT_KEY_REQUIRES"));
szBuffer.append(" ");
pExpr->buildDisplayString(szBuffer);
}
}
Code:
1>CvGameTextMgr.cpp(21237) : error C2227: left of '->getGameObjectConst' must point to class/struct/union
1> type is 'UnitTypes'
Surprisingly I got no other errors. I'm hoping this means we're doing pretty good up to this point.