building commerce and yield by resource

You probably need to call updateCorporation() after the building is built.
 
Opera, do you have both these two blocks of code?

Code:
void CvCity::updateCorporationCommerce(CommerceTypes eIndex)
{
	int iNewCommerce = 0;

	for (int iI = 0; iI < GC.getNumCorporationInfos(); iI++)
	{
		iNewCommerce += getCorporationCommerceByCorporation(eIndex, ((CorporationTypes)iI));
	}

[COLOR="red"]	// davidlallen: building bonus yield, commerce start
	for (int eBldg = 0; eBldg < GC.getNumBuildingInfos(); ++eBldg)
	{
		if (getNumRealBuilding((BuildingTypes)eBldg) > 0)
		{
			int eBonus = GC.getBuildingInfo((BuildingTypes)eBldg).getBonusConsumed();
			if (NO_BONUS != eBonus)
			{
				iNewCommerce += GC.getBuildingInfo((BuildingTypes)eBldg).getCommerceProduced(eIndex) * getNumBonuses((BonusTypes)eBonus) / 100;
			}
		}
	}
	// davidlallen: building bonus yield, commerce end[/COLOR]

	if (getCorporationCommerce(eIndex) != iNewCommerce)
	{
		m_aiCorporationCommerce[eIndex] = iNewCommerce;
		FAssert(getCorporationCommerce(eIndex) >= 0);

		updateCommerce(eIndex);
	}
}

Code:
void CvCity::updateCorporationYield(YieldTypes eIndex)
{
	int iOldYield = getCorporationYield(eIndex);
	int iNewYield = 0;

	for (int iI = 0; iI < GC.getNumCorporationInfos(); iI++)
	{
		iNewYield += getCorporationYieldByCorporation(eIndex, (CorporationTypes)iI);
	}

[COLOR="Red"]	// davidlallen: building bonus yield, commerce start
	for (int eBldg = 0; eBldg < GC.getNumBuildingInfos(); ++eBldg)
	{
		if (getNumRealBuilding((BuildingTypes)eBldg) > 0)
		{
			int eBonus = GC.getBuildingInfo((BuildingTypes)eBldg).getBonusConsumed();
			if (NO_BONUS != eBonus)
			{
				iNewYield += GC.getBuildingInfo((BuildingTypes)eBldg).getYieldProduced(eIndex) * getNumBonuses((BonusTypes)eBonus) / 100;
			}
		}
	}
	// davidlallen: building bonus yield, commerce end[/COLOR]


	if (iOldYield != iNewYield)
	{
		m_aiCorporationYield[eIndex] = iNewYield;
		FAssert(getCorporationYield(eIndex) >= 0);

		changeBaseYieldRate(eIndex, (iNewYield - iOldYield));
	}
}

I don't know if you are using a multi-bonus version, but that shouldn't differ two much. This is working fine in Dune Wars which also has copy non defaults.
 
I've merged this modcomp using Afforess' code. No problems compiling, except in the Civilopedia there's an empty line where the BCY-text should be. Here's a pic:
Spoiler :
Can someone fix this, please?
 
Top Bottom