[BNW] <Improvement_YieldPerEra> of my Custom Tile Improvement is not working, Help!

tac_NCVD

Chieftain
Joined
Feb 29, 2020
Messages
18
<Improvement_YieldPerEra> of my Custom Tile Improvement is not working, Help!
Code:
    <Improvement_YieldPerEra>
        <Row>
            <ImprovementType>IMPROVEMENT_CAT_CITADEL_ZHAO</ImprovementType>
            <YieldType>YIELD_SCIENCE</YieldType>
            <Yield>2</Yield>
        </Row>
    </Improvement_YieldPerEra>
 

Troller0001

I've anxiously awaited your arrival!
Joined
Mar 9, 2016
Messages
755
Location
The Netherlands
So YieldPerEra is a bit of a weird thing, and the name is rather misleading.
It works based on the era of archaeological records, and is for instance used for the landmark to give extra culture the older your artefact is. It does not give yields based on the construction era of the improvement.

The relevant source code:
Code:
    int iYieldChangePerEra = pImprovement->GetYieldChangePerEra(eYield);
    if (ePlayer != NO_PLAYER && iYieldChangePerEra > 0)
    {
        CvPlayerAI& kPlayer = GET_PLAYER(ePlayer);

        int iPlotEra = GetArchaeologicalRecord().m_eEra;
        int iNumEras = kPlayer.GetCurrentEra() - iPlotEra;

        if (iPlotEra != NO_ERA && iNumEras > 0)
        {
            iYield += (iNumEras * iYieldChangePerEra);
        }
    }
Specifically note that iPlotEra is based on the era of the archaeological record on the plot.
 
Top Bottom