whoward69
DLL Minion
Game beta has just updated from 3.124 to 3.128 and the SDK has also updated
Differences between 124 and 128 code base in the attached images
Differences between 124 and 128 code base in the attached images
if ((isEmbarked() && !pkBuildInfo->IsCanBeEmbarked()) && (strcmp("UNIT_JAPANESE_SAMURAI", getUnitInfo().GetType()) != 0))
Sometimes I just want to strangle someone
Code:if ((isEmbarked() && !pkBuildInfo->IsCanBeEmbarked()) && (strcmp("UNIT_JAPANESE_SAMURAI", getUnitInfo().GetType()) != 0))
a) Can we change the amount of reasearch per trade route and
b) How?
I know teach us newcomers a lesson
local g_ItemManagers = {
InstanceManager:new( "ItemInstance", "Button", Controls.YourCitiesStack ),
InstanceManager:new( "ItemInstance", "Button", Controls.MajorCivsStack ),
InstanceManager:new( "ItemInstance", "Button", Controls.CityStatesStack ),
}
int CvLuaPlayer::lGetPotentialInternationalTradeRouteDestinations(lua_State* L) {
SNIP!
CvPlayerTrade* pPlayerTrade = pkPlayer->GetTrade();
SNIP!
lua_createtable(L, 0, 0);
for (uint uiYield = 0; uiYield < NUM_YIELD_TYPES; uiYield++) {
lua_createtable(L, 0, 0);
const int t2 = lua_gettop(L);
lua_pushinteger(L, pPlayerTrade->GetTradeConnectionValueTimes100(kTradeConnection, (YieldTypes)uiYield, true));
lua_setfield(L, t2, "Mine");
lua_pushinteger(L, pOtherPlayerTrade->GetTradeConnectionValueTimes100(kTradeConnection, (YieldTypes)uiYield, false));
lua_setfield(L, t2, "Theirs");
lua_rawseti(L, -2, iInnerIndex++);
}
SNIP!
}
int CvPlayerTrade::GetTradeConnectionValueTimes100 (const TradeConnection& kTradeConnection, YieldTypes eYield, bool bAsOriginPlayer) {
SNIP
case YIELD_SCIENCE:
int iBaseValue = GetTradeConnectionBaseValueTimes100(kTradeConnection, eYield, bAsOriginPlayer);
iValue = iBaseValue;
int iModifier = 100;
iValue *= iModifier;
iValue /= 100;
break;
}
SNIP
}
int CvPlayerTrade::GetTradeConnectionBaseValueTimes100(const TradeConnection& kTradeConnection, YieldTypes eYield, bool bAsOriginPlayer) {
else if (eYield == YIELD_SCIENCE) {
int iTechDifference = GC.getGame().GetGameTrade()->GetTechDifference(kTradeConnection.m_eOriginOwner, kTradeConnection.m_eDestOwner);
int iAdjustedTechDifference = 0;
if (iTechDifference > 0) {
[COLOR="Red"][B] int iCeilTechDifference = (int)ceil(iTechDifference / 2.0f);[/B][/COLOR]
iAdjustedTechDifference = max(iCeilTechDifference, 1);
}
// Cultural influence bump
int iInfluenceBoost = GET_PLAYER(kTradeConnection.m_eOriginOwner).GetCulture()->GetInfluenceTradeRouteScienceBonus(kTradeConnection.m_eDestOwner);
iAdjustedTechDifference += iInfluenceBoost;
return iAdjustedTechDifference * 100;
}
SNIP
}
We know the trade route science is displayed when choosing where to send a trade unit ...
So search C:\Program Files (x86)\Steam\SteamApps\common\Sid Meier's Civilization V\ for files matching "trade*.lua"
ChooseInternationalTradeRoutePopup.lua looks like a good place to start
means I need to find where "g_ItemManagers[2]" is used - as that's the IM that hands out major city list items.Code:local g_ItemManagers = { InstanceManager:new( "ItemInstance", "Button", Controls.YourCitiesStack ), InstanceManager:new( "ItemInstance", "Button", Controls.MajorCivsStack ), InstanceManager:new( "ItemInstance", "Button", Controls.CityStatesStack ), }
It's not, but "g_ItemManagers[tradeRoute.Category]" is the only usage of g_ItemManagers, so it's got to be in that loop
"itemInstance.Bonuses:SetText(tradeRoute.Bonuses);" looks promising, so where does tradeRoute.Bonuses come from? ... g_Model
Which itself is populated from "table.insert(g_Model, tradeRoute);", where bonuses comes from "tradeRoute.Bonuses = strOutput;"
strOutput is built from myBonuses and theirBonuses
myBonuses is built from "u.Mine / 100" and u.Mine comes from "for j,u in ipairs(v.Yields) do"
v comes from "for i,v in ipairs(potentialTradeSpots) do" and potentialTradeSpots from pPlayer:GetPotentialInternationalTradeRouteDestinations(pUnit)
So we're looking for CvLuaPlayer::GetPotentialInternationalTradeRouteDestinations()
Which, unlike most Lua API methods doesn't just call a CvPlayer method, but contains a lot of code itself
So we're interested in CvPlayerTrade::GetTradeConnectionValueTimes100(...)Code:int CvLuaPlayer::lGetPotentialInternationalTradeRouteDestinations(lua_State* L) { SNIP! CvPlayerTrade* pPlayerTrade = pkPlayer->GetTrade(); SNIP! lua_createtable(L, 0, 0); for (uint uiYield = 0; uiYield < NUM_YIELD_TYPES; uiYield++) { lua_createtable(L, 0, 0); const int t2 = lua_gettop(L); lua_pushinteger(L, pPlayerTrade->GetTradeConnectionValueTimes100(kTradeConnection, (YieldTypes)uiYield, true)); lua_setfield(L, t2, "Mine"); lua_pushinteger(L, pOtherPlayerTrade->GetTradeConnectionValueTimes100(kTradeConnection, (YieldTypes)uiYield, false)); lua_setfield(L, t2, "Theirs"); lua_rawseti(L, -2, iInnerIndex++); } SNIP! }
So the base science comes from CvPlayerTrade::GetTradeConnectionBaseValueTimes100()Code:int CvPlayerTrade::GetTradeConnectionValueTimes100 (const TradeConnection& kTradeConnection, YieldTypes eYield, bool bAsOriginPlayer) { SNIP case YIELD_SCIENCE: int iBaseValue = GetTradeConnectionBaseValueTimes100(kTradeConnection, eYield, bAsOriginPlayer); iValue = iBaseValue; int iModifier = 100; iValue *= iModifier; iValue /= 100; break; } SNIP }
So science from trade routes is hard-coded as half of the difference in techs rounded upCode:int CvPlayerTrade::GetTradeConnectionBaseValueTimes100(const TradeConnection& kTradeConnection, YieldTypes eYield, bool bAsOriginPlayer) { else if (eYield == YIELD_SCIENCE) { int iTechDifference = GC.getGame().GetGameTrade()->GetTechDifference(kTradeConnection.m_eOriginOwner, kTradeConnection.m_eDestOwner); int iAdjustedTechDifference = 0; if (iTechDifference > 0) { [COLOR="Red"][B] int iCeilTechDifference = (int)ceil(iTechDifference / 2.0f);[/B][/COLOR] iAdjustedTechDifference = max(iCeilTechDifference, 1); } // Cultural influence bump int iInfluenceBoost = GET_PLAYER(kTradeConnection.m_eOriginOwner).GetCulture()->GetInfluenceTradeRouteScienceBonus(kTradeConnection.m_eDestOwner); iAdjustedTechDifference += iInfluenceBoost; return iAdjustedTechDifference * 100; } SNIP }
Simples!
a) can we change the amount of reasearch per trade route and
b) how
And sometimes you find one to make you laugh
CvDiplomacyAI:: DoDugUpMyYardStatement(...)
m_strNameIAmNotSupposedToBeUsedAnyMoreBecauseThisShouldNotBeCheckedAndWeNeedToPreserveSaveGameCompatibility
There are plenty of things to make us laugh and cry when it comes to the source code, but we must be grateful for what Firaxis does for us modders.
Not many companies are willing to release source code warts and all. We code for fun, most of them code for a pay check. Obviously the 80-20 rule has been used quite liberally![]()
Sometimes I just want to strangle someone
Code:if ((isEmbarked() && !pkBuildInfo->IsCanBeEmbarked()) && (strcmp("UNIT_JAPANESE_SAMURAI", getUnitInfo().GetType()) != 0))
YesHave they made the new Samurai fishing ability hardcoded?
Who makes these sort of stupid decisions?
/// Time to spawn a Great Prophet?
bool CvGameReligions::CheckSpawnGreatProphet(CvPlayer& kPlayer) {
UnitTypes eUnit = (UnitTypes)GC.getInfoTypeForString("[COLOR="Red"][B]UNIT_PROPHET[/B][/COLOR]", true);
Were you subscribed to the beta sdk, 'cos' mine's not updated ... off to force an update ...
It has updated for me and I did not subscribe to the beta. I don't know yet if the updated code matches the current version of the game, haven't tried using it.
Maybe there were no DLL changes between the last version of the beta patch and the final patch?