• Civilization 7 has been announced. For more info please check the forum here .

Where is the source for the lua command?


May 3, 2022
Hello everyone,
is anyone else deep into civ5 modding and can help me further?

I'm currently creating a complete mod in which I'm trying to fix all the small remaining bugs from the last official patch. (What would actually have been Fireaxis task :-D).
I've already fixed a lot (from negative diplo relationship count on Epic/Marathon to wrong calculation of city production per turn in the economic overview).

But I'm still stuck on the item "Income from diplomacy" in the economic overview:
Only the total balance is shown here (If + then for income, if - then for expenses).
But I think it was probably meant to show the diplomatic income and expenditure separately.

However, in the to the economic overview related file EconomicGeneralInfo.lua, only a total Diplo value is loaded. I haven't found the source yet though. Or do I maybe have to go down into the deeper DLL areas?


 -- Diplomacy
     local diploGPT = pPlayer:GetGoldPerTurnFromDiplomacy();
     if( diploGPT > 0 ) then
     local diploGPT = pPlayer:GetGoldPerTurnFromDiplomacy();
     if( diploGPT < 0 ) then
-> So there is still a source file in which the income and expenses are merged.
Anyone know where to find this?
pPlayer:GetGoldPerTurnFromDiplomacy() is a Lua API method in the DLL - the source code can be found in CvGameCoreSource\CvGameCoreDLL_Expansion2\Lua\CvLuaPlayer.cpp, but that is merely a wrapper to pkPlayer->GetTreasury()->GetGoldPerTurnFromDiplomacy() and that's in CvGameCoreSource\CvGameCoreDLL_Expansion2\CvTreasury.cpp but that's merely a getter for m_iGoldPerTurnFromDiplomacy so you'll need to track down all the places that's set or changed - either directly in the DLL or (possibly) from Lua
Top Bottom