Problem with forest chop yields

hr_oskar

Deity
Joined
Jun 21, 2002
Messages
624
Location
Iceland
In my medieval mod I've had an inexplicable problem since very early on in the modding: chopping forests doesn't yield any production at all.

I'm completely at loss as to what causes this since I didn't notice when the problem started so I'm not sure which change in particular could have caused it. It's very hard to backtrack by now and find out what exactly is the problem. I've compared the BuildInfos files of my mod and the vanilla game countless times and can't find anything there which could be a problem.

What may be relevant here is that I've completely removed the Fallout feature from my mod as well as a number of improvements and the Railroad routetype. I can't see how this would really matter but you never know :confused:

So, has anyone had a similar problem here or could someone familiar with the source code tell me which of the game files handle forest chopping so I could try to look a bit "under the hood"?

Any help much appreciated!
 
the xml file that control forest chop yields is in the CIV4BuildInfos.xml

path = assets\xml\units folder

I am not sure if this is the same for the warlords expansion though.... :blush:



hope that helps ;)
 
No, sorry but that doesn't help :/ I'm familiar with all the XML files and as I said I've modded the BuildInfos file quite a lot.

Thanks anyway :)
 
hr_oskar said:
In my medieval mod I've had an inexplicable problem since very early on in the modding: chopping forests doesn't yield any production at all.

I'm completely at loss as to what causes this since I didn't notice when the problem started so I'm not sure which change in particular could have caused it. It's very hard to backtrack by now and find out what exactly is the problem. I've compared the BuildInfos files of my mod and the vanilla game countless times and can't find anything there which could be a problem.

What may be relevant here is that I've completely removed the Fallout feature from my mod as well as a number of improvements and the Railroad routetype. I can't see how this would really matter but you never know :confused:

So, has anyone had a similar problem here or could someone familiar with the source code tell me which of the game files handle forest chopping so I could try to look a bit "under the hood"?

Any help much appreciated!

Here's the vanilla version of what goes into calculating how many hammers you get from removing a feature like a forest. If you're using WL you might want to check with CvPlot::getFeatureProduction.

If you have any questions, just ask.

Code:
int CvPlot::getFeatureProduction(BuildTypes eBuild, TeamTypes eTeam, CvCity** ppCity) const
{
	int iProduction;

	if (getFeatureType() == NO_FEATURE)
	{
		return 0;
	}

	*ppCity = getWorkingCity();

	if (*ppCity == NULL)
	{
		*ppCity = GC.getMapINLINE().findCity(getX_INLINE(), getY_INLINE(), NO_PLAYER, eTeam, false);
	}

	if (*ppCity == NULL)
	{
		return 0;
	}

	iProduction = (GC.getBuildInfo(eBuild).getFeatureProduction(getFeatureType()) - (max(0, (plotDistance(getX_INLINE(), getY_INLINE(), (*ppCity)->getX_INLINE(), (*ppCity)->getY_INLINE()) - 2)) * 5));

	iProduction = (*ppCity)->getExtraProductionDifference(iProduction);

	iProduction *= max(0, (GET_PLAYER((*ppCity)->getOwnerINLINE()).getFeatureProductionModifier() + 100));
	iProduction /= 100;

	iProduction *= GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getFeatureProductionPercent();
	iProduction /= 100;

	iProduction *= min((GC.getDefineINT("BASE_FEATURE_PRODUCTION_PERCENT") + (GC.getDefineINT("FEATURE_PRODUCTION_PERCENT_MULTIPLIER") * (*ppCity)->getPopulation())), 100);
	iProduction /= 100;

	if (getTeam() != eTeam)
	{
		iProduction *= GC.getDefineINT("DIFFERENT_TEAM_FEATURE_PRODUCTION_PERCENT");
		iProduction /= 100;
	}

	return max(0, iProduction);
}
 
That does help, thank you :)

Haven't solved the problem yet but it has to be traceable somewhere in there...
 
Back
Top Bottom