C++/Lua Request Thread

You forgot to hook up a (Game)Event to your function, so it never runs.
Try adding
Code:
GameEvents.PlayerDoTurn.Add(JeongJoGyujanggak)

Adding one or more print()'s to the code allows you to spot these kinds of mistakes way easier when you open up the Lua.log.

--
I'm assuming that JeongJoDummy, JeongJoDummy2, and JeongJoDummy3 do not provide tourism as you add multiple copies of those while tourism doesn't stack.

GameEvents.PlayerDoTurn.Add(JeongJoGyujanggak) is Not a problem. My lua code includes it, so never mind it. And I'm sorry that my English is bad, so I ask for understanding on that point.
I'll repeat. I want to get bonuses by the number of policies that I have adopt when Gyujanggak is in the city, and this is the code.

Code:
local JeongJoDummy = GameInfoTypes["BUILDING_JEONGJO_DUMMY"]
local JeongJoDummy2 = GameInfoTypes["BUILDING_JEONGJO_DUMMY2"]
local JeongJoDummy3 = GameInfoTypes["BUILDING_JEONGJO_DUMMY3"]
local JeongJoDummy4 = GameInfoTypes["BUILDING_JEONGJO_DUMMY4"]
local GyujanggakID = GameInfoTypes["BUILDING_GYUJANGGAK"]
function JeongJoGyujanggak(playerID, policyID)
   local pPlayer = Players[playerID]
    if pPlayer:GetCivilizationType() == JeongJo and pPlayer:IsAlive() then
        for pCity in pPlayer:Cities() do
            if pCity:IsHasBuilding(GyujanggakID) then
                local NumberOfPolicies = pPlayer:GetNumPolicies()
                if NumberOfPolicies >= 5 and NumberOfPolicies < 10 then
                    pCity:SetNumRealBuilding(JeongJoDummy, 1)
                end
                if NumberOfPolicies >= 10 and NumberOfPolicies < 15 then
                    pCity:SetNumRealBuilding(JeongJoDummy, 1)
                    pCity:SetNumRealBuilding(JeongJoDummy2, 1)
                end
                if NumberOfPolicies >= 15 and NumberOfPolicies < 20 then
                    pCity:SetNumRealBuilding(JeongJoDummy, 1)
                    pCity:SetNumRealBuilding(JeongJoDummy2, 2)
                end
                if NumberOfPolicies >= 20 and NumberOfPolicies < 25 then
                    pCity:SetNumRealBuilding(JeongJoDummy, 1)
                    pCity:SetNumRealBuilding(JeongJoDummy2, 2)
                    pCity:SetNumRealBuilding(JeongJoDummy3, 1)
                end
                if NumberOfPolicies >= 25 and NumberOfPolicies < 30 then
                    pCity:SetNumRealBuilding(JeongJoDummy, 2)
                    pCity:SetNumRealBuilding(JeongJoDummy2, 3)
                    pCity:SetNumRealBuilding(JeongJoDummy3, 1)
                end
                if NumberOfPolicies >= 30 and NumberOfPolicies < 40 then
                    pCity:SetNumRealBuilding(JeongJoDummy, 2)
                    pCity:SetNumRealBuilding(JeongJoDummy2, 3)
                    pCity:SetNumRealBuilding(JeongJoDummy3, 1)
                    pCity:SetNumRealBuilding(JeongJoDummy4, 1)
                end
                if NumberOfPolicies >= 40 then
                    pCity:SetNumRealBuilding(JeongJoDummy, 3)
                    pCity:SetNumRealBuilding(JeongJoDummy2, 4)
                    pCity:SetNumRealBuilding(JeongJoDummy3, 1)
                    pCity:SetNumRealBuilding(JeongJoDummy4, 0)
                    pCity:SetNumRealBuilding(JeongJoDummy5, 1)
                end
            end
        end
    end
end
GameEvents.PlayerDoTurn.Add(JeongJoGyujanggak)

※JeongJoDummy produces 5 culture. JeongJoDummy2 do 5 science. JeongJoDummy3 reduce culture requirement of policy. JeongJoDummy4 produce 5 tourism. JeongJoDummy5 do 10 Tourism.
※Bonuses that I get
5 policies or more and less than 10 policies that I have adopt - 5 culture
10 policies or more and less than 15 policies that I have adopt - 5 culture, 5 science
15 policies or more and less than 20 policies that I have adopt - 5 culture, 10 science
20 policies or more and less than 25 policies that I have adopt - 5 culture, 10 science, reduce culture requirement to adopt new policies
25 policies or more and less than 30 policies that I have adopt - 10 culture, 15 science, reduce culture requirement to adopt new policies
30 policies or more and less than 40 policies that I have adopt - 10 culture, 15 science, 5 tourism, reduce culture requirement to adopt new policies
40 policies or more that I have adopt - 15 culture, 20 science, 10 tourism, reduce culture requirement to adopt new policies

When the number of policies is 40 or more, all bonuses are applied well, without tourism. What is the problem?
 
You seem to define all of these:
Code:
local JeongJoDummy = GameInfoTypes["BUILDING_JEONGJO_DUMMY"]
local JeongJoDummy2 = GameInfoTypes["BUILDING_JEONGJO_DUMMY2"]
local JeongJoDummy3 = GameInfoTypes["BUILDING_JEONGJO_DUMMY3"]
local JeongJoDummy4 = GameInfoTypes["BUILDING_JEONGJO_DUMMY4"]
local GyujanggakID = GameInfoTypes["BUILDING_GYUJANGGAK"]
but as you can see the 5th dummy (JeongJoDummy5) is missing. I.e. it was not defined. (It might be a copy-paste error but without the mod itself it's just a guessing game).
I'm surprised that didn't throw a 'nil value' error nor added a different building to the city.
 
You seem to define all of these:
Code:
local JeongJoDummy = GameInfoTypes["BUILDING_JEONGJO_DUMMY"]
local JeongJoDummy2 = GameInfoTypes["BUILDING_JEONGJO_DUMMY2"]
local JeongJoDummy3 = GameInfoTypes["BUILDING_JEONGJO_DUMMY3"]
local JeongJoDummy4 = GameInfoTypes["BUILDING_JEONGJO_DUMMY4"]
local GyujanggakID = GameInfoTypes["BUILDING_GYUJANGGAK"]
but as you can see the 5th dummy (JeongJoDummy5) is missing. I.e. it was not defined. (It might be a copy-paste error but without the mod itself it's just a guessing game).
I'm surprised that didn't throw a 'nil value' error nor added a different building to the city.

Oh my God, I forgot to add it. Now, It works well. Thanks!
 
I'd like to add a new trait that when my Infantry units kill enemy units, I get Great General Points by combat of them.

Code:
local napoleon = GameInfoTypes["CIVILIZATION_NAPOLEON_FRANCE_HISTORAE"]
local isNapoleonActive    = BayetheMODActive(napoleon)
local napoleonboost = GameInfoTypes["PROMOTION_NAPOLEON_BOOST_HISTORIAE"]
local GreatGeneral = GameInfoTypes["UNIT_GREAT_GENERAL"]
function NapoleonGetGreatGeneralBoost(player, boost)
    local points = boost
    local GreatGeneralRate = pPlayer:GetGreatGeneralRateModifier()
end

function NapoleonGetGreatGeneralBoostByKill(killerID, killeeID, unitType)
    local pPlayer = Players[killerID];
    local pUnit = pPlayer:GetUnitByID(unitType)
    if pPlayer:IsAlive() and pPlayer:GetCivilizationType() == napoleon then
        if pUnit:IsHasPromotion(napoleonboost) then
            local boost = math.max(GameInfo.Units[unitType].Combat, GameInfo.Units[unitType].RangedCombat)
            NapoleonGetGreatGeneralBoost(player, boost)
        end
    end
end

function NapoleonInfantryGetPromotion(PlayerID, UnitID)
    local pPlayer = Players[PlayerID];
    local pUnit = pPlayer:GetUnitByID(UnitID)
    if pPlayer:IsAlive() and pPlayer:GetCivilizationType() == napoleon then
        if (pUnit:GetUnitType() == GameInfoTypes["UNIT_INFANTRY"]) then
            pUnit:SetHasPromotion(napoleonboost)
        end
    end
end
GameEvents.UnitKilledInCombat.Add(NapoleonGetGreatGeneralBoostByKill)
GameEvents.PlayerDoTurn.Add(NapoleonInfantryGetPromotion)

I'm making a code, but I can't do next things because I don't know what to do. I want to activate the function only when my unit(having special promotion) kill enemy. Also, I can't find api to Change Great General Points. Where is it? Please help me.
 
Last edited:
Ah, I have a another question. Can my units get combat bonuses in the continent that my Capital is in?
 
Hello, how can I eddit source code from JFD's Rise to Power:

Code:
--JFD_GetGovernmentTitle
function JFD_GetGovernmentTitle(playerID, thisGovernmentID)
    local player = Players[playerID]
    local civType = GameInfo.Civilizations[player:GetCivilizationType()].Type
    local civAdjective = player:GetCivilizationAdjective()
    local civShortDescription = player:GetCivilizationShortDescription()
    --Check for Policy-earned Names
    for row in GameInfo.Policy_JFD_CivilizationNames("CivilizationType = '" .. civType .. "'") do
        if player:HasPolicy(GameInfoTypes[row.PolicyType]) then
            civShortDescription = row.ShortDescription
            civAdjective = row.Adjective
        end
    end
    local isCivilisationPlural = JFD_IsCivilizationPlural(playerID)
    local useAdjective = false
    local governmentTitleText = ""
    local governmentTitleAdj = civAdjective:sub(1, -2)
    if (player:HasGovernment() or thisGovernmentID) then
        local governmentID = thisGovernmentID
        if (not governmentID) then governmentID = player:GetGovernment() end
        local government = GameInfo.JFD_Governments[governmentID]
        local isReligious = (governmentID == governmentTheocracyID)
        for row in GameInfo.JFD_Government_ReformTitles("GovernmentType = '" .. government.Type .. "'") do
            if ((not row.ReformType) or JFD_HasReform(playerID, GameInfoTypes[row.ReformType])) then
                governmentTitleText = row.TitleGovernment
                useAdjective = row.UseAdjective
                break
            end
        end
        local uniqueGovernmentTitleText, isAdj, useCapitalName = JFD_GetUniqueTitle(playerID, governmentTitleText, isReligious)
        if uniqueGovernmentTitleText then 
            if isAdj then
                return convertTextKey(uniqueGovernmentTitleText, governmentTitleAdj)
            else
                if useCapitalName then civShortDescription = player:GetCapitalCity():GetName() end
                return convertTextKey(uniqueGovernmentTitleText, civShortDescription)
            end
        else
            if useAdjective then 
                return convertTextKey(governmentTitleText, governmentTitleAdj)
            else
                return convertTextKey(governmentTitleText, civShortDescription)
            end
        end
    else
        if isCivilisationPlural then return civShortDescription end
        local governmentTitleText = "TXT_KEY_GOVERNMENT_JFD_TRIBE_TITLE_GOVERNMENT"
        local uniqueGovernmentTitleText, isAdj = JFD_GetUniqueTitle(playerID, governmentTitleText)
        if (not uniqueGovernmentTitleText) then 
            return convertTextKey(governmentTitleText, civAdjective)
        else
            if isAdj then
                return convertTextKey(uniqueGovernmentTitleText, civAdjective)
            else
                return convertTextKey(uniqueGovernmentTitleText, civShortDescription)
            end
        end
    end
end

In order to change game text from e.g. "British Republic" into "Britis Republic" - I need to get rid off one letter in every civilization adjective string, so I don't have to eddit all the civilizations text files. I've read something about :sub(1, -2) function, but I'm complete lama in this. And also, can I make it somehow language specific, so the last letter doesn't drop in every language? Thank you very much
 
Is there any way to scale Base Ranged Combat Strength to Base Combat Strength? Ranged Combat Strength doesn't increase when Base Combat Strength increased. Thanks.
 
Hi does anyone know code to make it so that when you make a unique improvement (Monolith in this case) it grants you a free luxury resource?

I've been trying to figure this out for ages and I'm having no luck. Thanks.
 
It's not C++ so it's not in the DLL. It appears to be a Lua representation of the flavour values for the techs - these are originally in the XML file that defines the core techs
 
I have been slowly self-teaching myself from the resources here (which are excellent!), and done some of the small tweaks my friends and I have wanted for awhile. I have hit a bit of a roadblock and was hoping I could get some help on how to approach it.

I want to change just the sound that plays when a world wonder is built if it is built by a member of your team. I'm not adverse to writing a custom notification for it modeled off the original.

My thought would be that when the notification for NOTIFICATION_WONDER_COMPLETED fires, a team check needs to be done. If the teamID of the civ who completed the wonder equals the teamID of the active player then it would trigger the sound for NOTIFICATION_WONDER_COMPLETED_ACTIVE_PLAYER, if not it would then continue on it's merry way to the 'enemy kicked your arse' sound.

Do I need to make a custom override notification for "NOTIFICATION_WONDER_COMPLETED"? I am thinking that is the only way I can build in the team check, but if there is an approach that is simpler to do I'm all ears. Also, which LUA/XML files am I going to need to play with to make this work?

Any help pointing me in the right direction would be super appreciated!
 
I have been slowly self-teaching myself from the resources here (which are excellent!), and done some of the small tweaks my friends and I have wanted for awhile. I have hit a bit of a roadblock and was hoping I could get some help on how to approach it.

I want to change just the sound that plays when a world wonder is built if it is built by a member of your team. I'm not adverse to writing a custom notification for it modeled off the original.

My thought would be that when the notification for NOTIFICATION_WONDER_COMPLETED fires, a team check needs to be done. If the teamID of the civ who completed the wonder equals the teamID of the active player then it would trigger the sound for NOTIFICATION_WONDER_COMPLETED_ACTIVE_PLAYER, if not it would then continue on it's merry way to the 'enemy kicked your arse' sound.

Do I need to make a custom override notification for "NOTIFICATION_WONDER_COMPLETED"? I am thinking that is the only way I can build in the team check, but if there is an approach that is simpler to do I'm all ears. Also, which LUA/XML files am I going to need to play with to make this work?

Any help pointing me in the right direction would be super appreciated!
No you just have to make changes to the NotificationPanel.lua concerning wonder notifications and adding in an elseif it's a teammate's notification.
 
No you just have to make changes to the NotificationPanel.lua concerning wonder notifications and adding in an elseif it's a teammate's notification.

Yikes, I was way overthinking it. Thank you. Helps get me on the right track.

I will have to take another look at the NotificationPanel.lua and figure out where/how the elseif will work for the desired outcome.
 
Can anyone add support for Policy_InternalTradeRouteYieldChange in the dll? I tried but i can't understand how to tell C++, i'm new to it although i know the syntax and things such as variables i cant figure out how to do it, i believe the only things to touch would be cvtradeclasses.cpp (and h) and cvpolicyclasses.cpp (and h)
 
Can anyone add support for Policy_InternalTradeRouteYieldChange in the dll? I tried but i can't understand how to tell C++, i'm new to it although i know the syntax and things such as variables i cant figure out how to do it, i believe the only things to touch would be cvtradeclasses.cpp (and h) and cvpolicyclasses.cpp (and h)

Have you got the base DLL compiled and working as a mod, and then made a simple change (ie followed my first DLL tutorial?)

The change you want is 16 lines of C++ code and one SQL statement (to add the new column to the Policies table), but if you've not got a modded DLL working ...
 
i actually got it to work, but what i did not understand is where i had to edit the tradeclasses.cpp. Now i want to add a policy_freebuilding table but seems much harder to have a modular one rather than a preset one like freefoodbuilding
 
Now i want to add a policy_freebuilding table but seems much harder to have a modular one rather than a preset one like freefoodbuilding
Correct. This is a different order of pain! One of my DLL tutorials covers adding a secondary database table
 
Did you resolve this?

Yes, i had a reference by looking at the nqmod's dll

Code:
int CvPlayerTrade::GetTradeConnectionValueTimes100 (const TradeConnection& kTradeConnection, YieldTypes eYield, bool bAsOriginPlayer)
{
    CvGameTrade* pTrade = GC.getGame().GetGameTrade();
    int iValue = 0;

    if (bAsOriginPlayer)
    {
        if (pTrade->IsConnectionInternational(kTradeConnection))
        {
            switch (eYield)
            {
            case YIELD_GOLD:
                {
                    int iBaseValue = GetTradeConnectionBaseValueTimes100(kTradeConnection, eYield, bAsOriginPlayer);
                    int iOriginPerTurnBonus = GetTradeConnectionGPTValueTimes100(kTradeConnection, eYield, bAsOriginPlayer, true);
                    int iDestPerTurnBonus = GetTradeConnectionGPTValueTimes100(kTradeConnection, eYield, bAsOriginPlayer, false);
                    int iResourceBonus = GetTradeConnectionResourceValueTimes100(kTradeConnection, eYield, bAsOriginPlayer);
                    int iExclusiveBonus = GetTradeConnectionExclusiveValueTimes100(kTradeConnection, eYield);
                    int iPolicyBonus = GetTradeConnectionPolicyValueTimes100(kTradeConnection, eYield);
                    int iYourBuildingBonus = GetTradeConnectionYourBuildingValueTimes100(kTradeConnection, eYield, bAsOriginPlayer);
                    int iTheirBuildingBonus = GetTradeConnectionTheirBuildingValueTimes100(kTradeConnection, eYield, bAsOriginPlayer);
                    int iTraitBonus = GetTradeConnectionOtherTraitValueTimes100(kTradeConnection, eYield, bAsOriginPlayer);

                    int iModifier = 100;
                    int iDomainModifier = GetTradeConnectionDomainValueModifierTimes100(kTradeConnection, eYield);
                    int iOriginRiverModifier = GetTradeConnectionRiverValueModifierTimes100(kTradeConnection, eYield, bAsOriginPlayer);

                    iValue = iBaseValue;
                    iValue += iOriginPerTurnBonus;
                    iValue += iDestPerTurnBonus;
                    iValue += iExclusiveBonus;
                    iValue += iYourBuildingBonus;
                    iValue += iTheirBuildingBonus;
                    iValue += iResourceBonus;
                    iValue += iPolicyBonus;
                    iValue += iTraitBonus;

                    iModifier += iDomainModifier;
                    iModifier += iOriginRiverModifier;

                    iValue *= iModifier;
                    iValue /= 100;
                    iValue = max(100, iValue);
                }
                break;
#if defined(MOD_API_UNIFIED_YIELDS)
            case YIELD_CULTURE:
            case YIELD_FAITH:
#endif
#if defined(MOD_API_UNIFIED_YIELDS_TOURISM)
            case YIELD_TOURISM:
#endif
#if defined(MOD_API_UNIFIED_YIELDS_GOLDEN_AGE)
            case YIELD_GOLDEN_AGE_POINTS:
#endif
            case YIELD_SCIENCE:
#if defined(MOD_API_UNIFIED_YIELDS)
                {
#endif
                    int iBaseValue = GetTradeConnectionBaseValueTimes100(kTradeConnection, eYield, bAsOriginPlayer);
#if defined(MOD_API_UNIFIED_YIELDS)
                    int iPolicyBonus = GetTradeConnectionPolicyValueTimes100(kTradeConnection, eYield);
                    int iTraitBonus = GetTradeConnectionOtherTraitValueTimes100(kTradeConnection, eYield, bAsOriginPlayer);
#endif

                    iValue = iBaseValue;
#if defined(MOD_API_UNIFIED_YIELDS)
                    iValue += iPolicyBonus;
                    iValue += iTraitBonus;
#endif

                    int iModifier = 100;
               
                    iValue *= iModifier;
                    iValue /= 100;
#if defined(MOD_API_UNIFIED_YIELDS)
                }
#endif
                break;
            }
        }
    }
    else
    {
        if (pTrade->IsConnectionInternational(kTradeConnection))
        {
            if (kTradeConnection.m_eDestOwner == m_pPlayer->GetID()) //what is this for?
            {
                switch (eYield)
                {
                case YIELD_GOLD:
                    {
                        int iBaseValue = GetTradeConnectionBaseValueTimes100(kTradeConnection, eYield, bAsOriginPlayer);
                        int iYourBuildingBonus = GetTradeConnectionYourBuildingValueTimes100(kTradeConnection, eYield, bAsOriginPlayer);
                        int iTheirBuildingBonus = GetTradeConnectionTheirBuildingValueTimes100(kTradeConnection, eYield, bAsOriginPlayer);

                        int iModifier = 100;
                        int iDomainModifier = GetTradeConnectionDomainValueModifierTimes100(kTradeConnection, eYield);
                        int iDestRiverModifier = GetTradeConnectionRiverValueModifierTimes100(kTradeConnection, eYield, false);
                        int iTraitBonus = GetTradeConnectionOtherTraitValueTimes100(kTradeConnection, eYield, false);

                        iValue = iBaseValue;
                        iValue += iYourBuildingBonus;
                        iValue += iTheirBuildingBonus;
                        iValue += iTraitBonus;

                        iModifier += iDomainModifier;
                        iModifier += iDestRiverModifier;

                        iValue *= iModifier;
                        iValue /= 100;
                    }
                    break;
#if defined(MOD_API_UNIFIED_YIELDS)
                case YIELD_CULTURE:
                case YIELD_FAITH:
#endif
#if defined(MOD_API_UNIFIED_YIELDS_TOURISM)
                case YIELD_TOURISM:
#endif
#if defined(MOD_API_UNIFIED_YIELDS_GOLDEN_AGE)
                case YIELD_GOLDEN_AGE_POINTS:
#endif
                case YIELD_SCIENCE:
                    {
                        int iBaseValue = GetTradeConnectionBaseValueTimes100(kTradeConnection, eYield, bAsOriginPlayer);
#if defined(MOD_API_UNIFIED_YIELDS)
                        int iTraitBonus = GetTradeConnectionOtherTraitValueTimes100(kTradeConnection, eYield, false);
#endif

                        int iModifier = 100;

                        iValue = iBaseValue;
#if defined(MOD_API_UNIFIED_YIELDS)
                        iValue += iTraitBonus;
#endif

                        iValue *= iModifier;
                        iValue /= 100;                      
                    }
                    break;
                }
            }
        }
        else
        {
            iValue = GET_PLAYER(kTradeConnection.m_eDestOwner).getInternalTradeRouteYieldChange(kTradeConnection.m_eDomain, eYield) * 100; //Policy_InternalTradeRouteYieldChange
            switch (kTradeConnection.m_eConnectionType)
            {
            case TRADE_CONNECTION_FOOD:
                if (eYield == YIELD_FOOD)
                {
#if defined(MOD_TRADE_ROUTE_SCALING)
                    iValue = GD_INT_GET(TRADE_ROUTE_BASE_FOOD_VALUE);
#else
                    iValue = 300;
#endif
#if defined(MOD_API_UNIFIED_YIELDS)
                    iValue += GetTradeConnectionPolicyValueTimes100(kTradeConnection, eYield);
                    iValue += GetTradeConnectionOtherTraitValueTimes100(kTradeConnection, eYield, false);
#endif
                    iValue += GC.getEraInfo(GET_PLAYER(kTradeConnection.m_eDestOwner).GetCurrentEra())->getTradeRouteFoodBonusTimes100();
                    iValue *= GC.getEraInfo(GC.getGame().getStartEra())->getGrowthPercent();
                    iValue /= 100;

                    int iModifier = 100;
                    int iDomainModifier = GetTradeConnectionDomainValueModifierTimes100(kTradeConnection, eYield);
                    iModifier += iDomainModifier;
                    iModifier += GET_PLAYER(kTradeConnection.m_eDestOwner).GetPlayerPolicies()->GetNumericModifier(POLICYMOD_INTERNAL_TRADE_MODIFIER);
                    iValue *= iModifier;
                    iValue /= 100;
                }
                break;
            case TRADE_CONNECTION_PRODUCTION:
                if (eYield == YIELD_PRODUCTION)
                {
#if defined(MOD_TRADE_ROUTE_SCALING)
                    iValue = GD_INT_GET(TRADE_ROUTE_BASE_PRODUCTION_VALUE);
#else
                    iValue = 300;
#endif
#if defined(MOD_API_UNIFIED_YIELDS)
                    iValue += GetTradeConnectionPolicyValueTimes100(kTradeConnection, eYield);
                    iValue += GetTradeConnectionOtherTraitValueTimes100(kTradeConnection, eYield, false);
#endif
                    iValue += GC.getEraInfo(GET_PLAYER(kTradeConnection.m_eDestOwner).GetCurrentEra())->getTradeRouteProductionBonusTimes100();
                    iValue *= (GC.getEraInfo(GC.getGame().getStartEra())->getConstructPercent() + GC.getEraInfo(GC.getGame().getStartEra())->getTrainPercent()) / 2;
                    iValue /= 100;

                    int iModifier = 100;
                    int iDomainModifier = GetTradeConnectionDomainValueModifierTimes100(kTradeConnection, eYield);
                    iModifier += iDomainModifier;
                    iModifier += GET_PLAYER(kTradeConnection.m_eDestOwner).GetPlayerPolicies()->GetNumericModifier(POLICYMOD_INTERNAL_TRADE_MODIFIER);
                    iValue *= iModifier;
                    iValue /= 100;
                }
                break;
            }
        }
    }

    return iValue;  
}
Thank you very much for the Unified Yield code, it is very nice.

EDIT: i havent done any extensive testing with all the yields and stuff but it seems to work just fine


I don't have a reference for the free building column (probably easier than a table) code so i'm not sure where i have to inject, maybe CvPlayer::AwardFreeBuilding but as i am new to object oriented languages, i don't know how to actually get it done, in my plan was also to add new yield such as great artist point yield but i don't know if its something such as just adding it to the enums, then cvcity and cvplayer and cvtrait or cvpolicy or more complicated
 
Free buildings are a PITA - as you have to add all the code to remember how many are owed when the player saves a game - look for the BUGFIX_FREE_FOOD_BUILDING stuff

New yields are not something to be undertaken lightly (loads of UI considerations as well as all the coding spaghetti to dig through) - look for the UNIFIED_YIELDS_TOURISM stuff
 
Top Bottom