(1.0.12.28) Tokugawa and Portugal's Trade Route abilities are bugged in the Trade Route UI

pokiehl

Deity
Joined
Mar 5, 2017
Messages
2,719
Tokugawa and Portugal both have Trade Route yield modifiers on International Trade Routes.
Tokugawa's -25% yield penalty does not appropriately show up for Faith on the Trade Route preview, and neither does Portugal's +50% yield bonus.

For some reason, Faith is bugged for both of these abilities.

I looked through the TradeSupport.lua file, and it seems to me this is a bug with "kYieldMultipliers" not returning the right value for the Faith yield only. Seems like something that must be fixed in the DLL.

Note that the abilities themselves actually do work properly; you will get -25% Faith from Tokugawa and +50% Faith with Portugal, it's just that the Trade Route selector UI is wrong.

--- You can see the bug in my screenshot below as Tokugawa. My Trade Route to Beroea says it gives +6.8 Gold, +0.8 Science, and +1 Faith. In actuality, I will receive +0.8 Faith due to Tokugawa's penalty.
20221221131952_1.jpg
 
It is actually a Lua error in the script, TradeSupport.lua. DLL works ok, correct values are returned. There is a mismatch in yield indexing. The game uses 0..5 and devs coded 1..6. Since 6 doesn't exist then the DLL it always returns 1.
The fix is super easy. In lines 93 and 96 in TradeSupport.lua one needs to change:
kYieldMultipliers[yieldIndex] = pPlayerTrade:GetInternationalYieldModifier(yieldIndex);
into this:
kYieldMultipliers[yieldIndex] = pPlayerTrade:GetInternationalYieldModifier(yieldIndex-1);
The above will fix it ofc both for Portugal and Tokugawa, and any other case where yield multipliers are applied.
 
It is actually a Lua error in the script, TradeSupport.lua. DLL works ok, correct values are returned. There is a mismatch in yield indexing. The game uses 0..5 and devs coded 1..6. Since 6 doesn't exist then the DLL it always returns 1.
The fix is super easy. In lines 93 and 96 in TradeSupport.lua one needs to change:
kYieldMultipliers[yieldIndex] = pPlayerTrade:GetInternationalYieldModifier(yieldIndex);
into this:
kYieldMultipliers[yieldIndex] = pPlayerTrade:GetInternationalYieldModifier(yieldIndex-1);
The above will fix it ofc both for Portugal and Tokugawa, and any other case where yield multipliers are applied.
You are amazing!!!! This bug has been bothering me since Portugal was released!! Thank you so much :)
 
Which copy of TradeSupport.lua needs to be modified though - I have 2 copies here
 

Attachments

  • Capture.JPG
    Capture.JPG
    23.5 KB · Views: 36
It is actually a Lua error in the script, TradeSupport.lua. DLL works ok, correct values are returned. There is a mismatch in yield indexing. The game uses 0..5 and devs coded 1..6. Since 6 doesn't exist then the DLL it always returns 1.
The fix is super easy. In lines 93 and 96 in TradeSupport.lua one needs to change:
kYieldMultipliers[yieldIndex] = pPlayerTrade:GetInternationalYieldModifier(yieldIndex);
into this:
kYieldMultipliers[yieldIndex] = pPlayerTrade:GetInternationalYieldModifier(yieldIndex-1);
The above will fix it ofc both for Portugal and Tokugawa, and any other case where yield multipliers are applied.
Just wanted to confirm that the fix worked beautifully, Infixo. All yields are showing properly. Thank you again---I REALLY appreciate this.

It occurred to me that since the yield indexing is mismatched, the UI must be bugged for Food too. I guess I never noticed it because in general you don't get Food from International routes.
 
Could You guys report it on the 2k support? If you provide a working solution with the technical explanation and screenshots there is a chance this will get fixed for everybody during the leader pass. Thanks.
 
There was a change. I'm not on my PC right now so I cannot show the diff, but here is a screenshot from the steamdb.
 

Attachments

  • 20230128_104630.jpg
    20230128_104630.jpg
    521.8 KB · Views: 40
There was a change. I'm not on my PC right now so I cannot show the diff, but here is a screenshot from the steamdb.
Yeah, I saw that and windows explorer also confirms it was changed, but when I pull up the pre-hotfix and post-hotfix files and compare they are the same. It's also the same from the December update.
 
It doesn't look like they actually changed anything in the TradeSupport.lua even though the file in explorer shows that it was modified. I compared the files from Dec., Jan., & the Hotfix and they're all identical. 🤔
They fixed it exactly in the way I proposed.
 
They fixed it exactly in the way I proposed.
Interesting because there isn't any difference in that file in all my LP backups. I had to go back to the last patch of the NFP to see the original argument (i.e. (yieldIndex)).

I guess it doesn't really matter how they fixed it, though, just as long as it's fixed for everyone so I'm not going to worry about it.
 
How so exactly? Because there isn't any difference in the file.
I am wondering if your file just hasn't updated or something? I triple checked my version and @Infixo and @robal1991 are correct. Lines 93 and 96 changed "yieldIndex" to "yieldIndex-1" -- just as Infixo originally discovered and suggested in the earlier posts here.
 
I am wondering if your file just hasn't updated or something? I triple checked my version and @Infixo and @robal1991 are correct. Lines 93 and 96 changed "yieldIndex" to "yieldIndex-1" -- just as Infixo originally discovered and suggested in the earlier posts here.
IDK, those lines have had yieldIndex-1 in all three of my backup LP files including the ones from before Infixo's post. I had to go back to the last NFP update to see the original yieldIndex argument. Like I said it doesn't really matter as long as it's fixed now for everyone. 🤷‍♀️
 
Top Bottom