resources

anima36

Warlord
Joined
Aug 15, 2006
Messages
141
does anyone how much the resource effects like health and happines are governed by python programming and where can i find this. i know the amount of health or happiness can be changed in the XML but i was more interestd in the code that links having cows for example and having a +1 health bonus.
 
I'm prety sure you could do that with XML, but if not, you could get around it by making a cheap building that gives a health bonus with cows. A stable, perhaps?
 
i wanted to see where the code that says

if city has a trade route to cows then give city +1 bonus health

and also how it looks
 
You can find this in BONUSINFOS xml file, the important part is in bold. Pretty straighforward....

Spoiler :
<BonusInfo>
<Type>BONUS_COW</Type>
<Description>TXT_KEY_BONUS_COW</Description>
<Civilopedia>TXT_KEY_BONUS_COW_PEDIA</Civilopedia>
<BonusClassType>BONUSCLASS_LIVESTOCK</BonusClassType>
<ArtDefineTag>ART_DEF_BONUS_COW</ArtDefineTag>
<TechReveal>NONE</TechReveal>
<TechCityTrade>TECH_ANIMAL_HUSBANDRY</TechCityTrade>
<TechObsolete>NONE</TechObsolete>
<YieldChanges>
<iYieldChange>1</iYieldChange>
<iYieldChange>0</iYieldChange>
<iYieldChange>0</iYieldChange>
</YieldChanges>
<iAITradeModifier>0</iAITradeModifier>
<iHealth>1</iHealth>
<iHappiness>0</iHappiness>
<iPlacementOrder>4</iPlacementOrder>
<iConstAppearance>50</iConstAppearance>
<iMinAreaSize>3</iMinAreaSize>
<iMinLatitude>0</iMinLatitude>
<iMaxLatitude>50</iMaxLatitude>
<Rands>
<iRandApp1>25</iRandApp1>
<iRandApp2>25</iRandApp2>
<iRandApp3>0</iRandApp3>
<iRandApp4>0</iRandApp4>
</Rands>
<iPlayer>0</iPlayer>
<iTilesPer>16</iTilesPer>
<iMinLandPercent>0</iMinLandPercent>
<iUnique>0</iUnique>
<iGroupRange>0</iGroupRange>
<iGroupRand>0</iGroupRand>
<bArea>1</bArea>
<bHills>0</bHills>
<bFlatlands>1</bFlatlands>
<bNoRiverSide>1</bNoRiverSide>
<bNormalize>1</bNormalize>
<TerrainBooleans>
<TerrainBoolean>
<TerrainType>TERRAIN_GRASS</TerrainType>
<bTerrain>1</bTerrain>
</TerrainBoolean>
<TerrainBoolean>
<TerrainType>TERRAIN_PLAINS</TerrainType>
<bTerrain>1</bTerrain>
</TerrainBoolean>
</TerrainBooleans>
<FeatureBooleans/>
<FeatureTerrainBooleans/>
</BonusInfo>
 
but this is not coding it is xml. it just says how much health to give for each resource where is the coding!! i want to find the CODE that governs the effect of resources on a city.
 
anima36 said:
but this is not coding it is xml. it just says how much health to give for each resource where is the coding!! i want to find the CODE that governs the effect of resources on a city.

That code is actually found in the SDK, not python.

CvCity.cpp:

Code:
int CvCity::getBonusHealth(BonusTypes eBonus)
{
	int iHealth;
	int iI;

	iHealth = GC.getBonusInfo(eBonus).getHealth();

	for (iI = 0; iI < GC.getNumBuildingInfos(); iI++)
	{
		if (hasActiveBuilding((BuildingTypes)iI))
		{
			iHealth += GC.getBuildingInfo((BuildingTypes) iI).getBonusHealthChanges(eBonus);
		}
	}

	return iHealth;
}

Edit: Actually, that doesn't appear to be the exact line of code you're looking for, but I would think that it is in either CvCity.cpp, CvPlot.cpp, or CvPlotGroup.cpp. Check out CvPlot::updatePlotGroupBonus and CvPlotGroup::changeNumBonuses
 
Back
Top Bottom