Colopedia of Improvments not showing Yield Increase of Bonus Ressources

raystuttgart

Civ4Col Modder
Joined
Jan 24, 2011
Messages
9,672
Location
Stuttgart, Germany
Hey guys,

there is a small issue in Colopedia for Improvments:
(Slopiness of Vanilla Coders)

Improvments can be configured to increase Yield output of specifc Bonus Resources:

Spoiler :

Code:
<BonusTypeStruct>
	 <BonusType>BONUS_POTATO</BonusType>
	<bBonusMakesValid>1</bBonusMakesValid>
	 <iDiscoverRand>0</iDiscoverRand>
	 <YieldChanges>
		 <YieldIntegerPair>
			[COLOR="Red"]<YieldType>YIELD_FOOD</YieldType>
			<iValue>1</iValue>[/COLOR]
		</YieldIntegerPair>
	</YieldChanges>
</BonusTypeStruct>


However, this is not reflected in Colopedia.

This tiny issue has been on my list of "todos" but I never got to fix it.
Has anybody else maybe already fixed this small issue in Colopedia ?

If somebody did, I would really appreciate, if that person could post the code here. :thumbsup:
 
I believe the code you are looking for is
Code:
for iBonus in range(gc.getNumCivicInfos()):
	for k in range(YieldTypes.NUM_YIELD_TYPES):
		iYieldChange = gc.getImprovementInfo(self.iImprovement).getImprovementBonusYield(iBonus, k)
		if (iYieldChange != 0):
			szYield += localText.getText("TXT_KEY_PEDIA_BONUS_YIELD", (gc.getYieldInfo(k).getTextKey(), iYieldChange, gc.getYieldInfo(k).getChar())) + u"\n"
Naturally TXT_KEY_PEDIA_BONUS_YIELD would have to be added and the name of the bonus should likely also be a parameter.

However after adding this I noticed the list became really long and I lost the overview. I was like "I can do better than that". I attached a screenshot of work in progress. It's missing icons to the far left and there is a number of other issues, but it started to look like I imagined when I started :)
 

Attachments

  • ImprovementPedia.JPG
    ImprovementPedia.JPG
    250.2 KB · Views: 108
I believe the code you are looking for is

No it isn't. :(
I think you misunderstand what I am talking about.

In CIV4ImprovementInfos.xml take a look at <BonusTypeStructs>.

An Improvment can give additional increase of specific Yield if it is build on a specific Bonus Ressource.

e.g. Mine will increase output of Yield Gems if built upon Bonus Ressource Gems.
(Yield Gems is only available on Bonus Ressource Gems in RaR.)

In such a case Colopedia of Improvment Mine should tells something like that:
(But currently it doesn't tell at all.)

+2 <Icon Gems> on Bonus Ressource Gems

Edit:

Maybe we are talking about the same. :think:

Because this is the correct method to call for getting the Yield increas on Bonus Ressource:

Code:
iYieldChange = gc.getImprovementInfo(self.iImprovement).[COLOR="Green"]getImprovementBonusYield[/COLOR](iBonus, k)

This line is a bit confusing for me though:
Code:
for iBonus in range(gc.getNum[COLOR="Red"]CivicInfos[/COLOR]()):

Also it is probably not necessary to create (huge) tables.
 
This line is a bit confusing for me though:
Code:
for iBonus in range(gc.getNum[COLOR="Red"]CivicInfos[/COLOR]()):
:eek:
No wonder it doesn't work correctly for all improvements. I somehow made a copy paste error :crazyeye:

Also it is probably not necessary to create (huge) tables.
I will look at size once it fills correctly. I added the info as extra lines and it became so many that I lost the overview. The main problem was that if I want to grow food on potatoes next to a river, then all the bonus info for that combo would be spread all over the lines mixed with non-essential data for that task. Besides even just looking at a single bonus resource was an issue as that too would spread across several lines. Dedicating a line for each bonus resource would make it easier to read.

The page currently has a size problem as the addition of the history text screwed scaling between different screen resolutions. This mean once this is done the scaling of the whole page needs reviewing. I improved this a bit to make room for the table, but it might be a good idea to pay more attention to this issue once the table works.
 
Back
Top Bottom