I made forts able to get resources outside cities by making forts own land and add culture to the plot. I thought maybe some people would be interested in the code so I am posting it here.
this is the python code and simply adds culture and land ownership to the plot
pretty self explanatory:
The following was added to CvPlot::CalculateCulturalOwner() im not sure if its needed tho:
this was added to CvPlot::isWithinCultureRange()
That should be it. Hopefully someone can find this usefull I know there were alot people interested in any threads I could find on the subject.
this is the python code and simply adds culture and land ownership to the plot
pretty self explanatory:
Code:
def onImprovementBuilt(self, argsList):
'Improvement Built'
iImprovement, iX, iY = argsList
pPlot = gc.getMap().plot(iX,iY)
pPlayer = gc.getPlayer(pPlot.getUnit(1).getOwner())
if (iImprovement == gc.getInfoTypeForString("IMPROVEMENT_FORT")):
CyInterface().addImmediateMessage("onImprovementBuilt called FORT","")
CyMap().plot(iX, iY).setOwner(pPlayer.getID())
CyMap().plot(iX, iY).changeCulture(pPlayer.getID(), 10, False)
The following was added to CvPlot::CalculateCulturalOwner() im not sure if its needed tho:
Code:
if (isForceUnowned() && getImprovementType() != GC.getInfoTypeForString("IMPROVEMENT_FORT")) //Primax 0.1 Forts Culture
//if (isForceUnowned())
{
return NO_PLAYER;
}
this was added to CvPlot::isWithinCultureRange()
Code:
bool CvPlot::isWithinCultureRange(PlayerTypes ePlayer) const
{
int iI;
for (iI = 0; iI < GC.getNumCultureLevelInfos(); ++iI)
{
if (isCultureRangeCity(ePlayer, iI) || getImprovementType() == GC.getInfoTypeForString("IMPROVEMENT_FORT")) // Primax 0.1 FORT
//if (isCultureRangeCity(ePlayer, iI))
{
return true;
}
}
return false;
}
That should be it. Hopefully someone can find this usefull I know there were alot people interested in any threads I could find on the subject.