Andrew_Jay
Prince
- Joined
- Aug 4, 2002
- Messages
- 438
I have a scenario I'm working on where I want a new religion to emerge late in the game and spread fairly healthily.
I learned from this thread that the way the game works, natural religion spread only applies to cities without religion. Since my cities will have a religion by the time this new religion emerges, I'm out of luck.
I basically have two questions:
1. editing the python to allow natural spread when there are already religions.
I've already found the correct file, "CvCity.cpp" and the following text:
I'm guess it will just take changing a few zeros into 1's?
"if (getReligionCount() == 0)" changed to "if (getReligionCount() == 1)"
and
"for (iI = 1; iI < GC.getNumReligionInfos(); iI++)" changed to "for (iI = 1; iI < GC.getNumReligionInfos(); iI++)"
?
Or would more have to be changed? There's only two religions in the scenario, so all I'm looking for is to have the system act the same towards one religion as it currently acts towards no religion.
2. Assuming I edit this file properly, how do I put it into a mod?
It is not one of the regular python files under assets, rather, it's under "CvGameCoreDLL", so how do you put it into a mod's folder?
(Oh, like the title says, I'm trying to do this in Warlords)
Thanks for any help!
I learned from this thread that the way the game works, natural religion spread only applies to cities without religion. Since my cities will have a religion by the time this new religion emerges, I'm out of luck.
I basically have two questions:
1. editing the python to allow natural spread when there are already religions.
I've already found the correct file, "CvCity.cpp" and the following text:
Code:
void CvCity::doReligion()
{
CvCity* pLoopCity;
int iRandThreshold;
int iSpread;
int iLoop;
int iI, iJ;
CyCity* pyCity = new CyCity(this);
CyArgsList argsList;
argsList.add(gDLL->getPythonIFace()->makePythonObject(pyCity)); // pass in city class
long lResult=0;
gDLL->getPythonIFace()->callFunction(PYGameModule, "doReligion", argsList.makeFunctionArgs(), &lResult);
delete pyCity; // python fxn must not hold on to this pointer
if (lResult == 1)
{
return;
}
if (getReligionCount() == 0)
{
for (iI = 0; iI < GC.getNumReligionInfos(); iI++)
{
if (!isHasReligion((ReligionTypes)iI))
{
if ((iI == GET_PLAYER(getOwnerINLINE()).getStateReligion()) || !(GET_PLAYER(getOwnerINLINE()).isNoNonStateReligionSpread()))
{
iRandThreshold = 0;
for (iJ = 0; iJ < MAX_PLAYERS; iJ++)
{
if (GET_PLAYER((PlayerTypes)iJ).isAlive())
{
for (pLoopCity = GET_PLAYER((PlayerTypes)iJ).firstCity(&iLoop); pLoopCity != NULL; pLoopCity = GET_PLAYER((PlayerTypes)iJ).nextCity(&iLoop))
{
if (pLoopCity->isConnectedTo(this))
{
iSpread = pLoopCity->getReligionInfluence((ReligionTypes)iI);
iSpread *= GC.getReligionInfo((ReligionTypes)iI).getSpreadFactor();
if (iSpread > 0)
{
iSpread /= max(1, (((GC.getDefineINT("RELIGION_SPREAD_DISTANCE_DIVISOR") * plotDistance(getX_INLINE(), getY_INLINE(), pLoopCity->getX_INLINE(), pLoopCity->getY_INLINE())) / GC.getMapINLINE().maxPlotDistance()) - 5));
//iSpread /= (getReligionCount() + 1);
iRandThreshold = max(iRandThreshold, iSpread);
}
}
}
}
}
if (GC.getGameINLINE().getSorenRandNum(GC.getDefineINT("RELIGION_SPREAD_RAND"), "Religion Spread") < iRandThreshold)
{
setHasReligion(((ReligionTypes)iI), true, true);
break;
}
}
}
}
}
}
"if (getReligionCount() == 0)" changed to "if (getReligionCount() == 1)"
and
"for (iI = 1; iI < GC.getNumReligionInfos(); iI++)" changed to "for (iI = 1; iI < GC.getNumReligionInfos(); iI++)"
?
Or would more have to be changed? There's only two religions in the scenario, so all I'm looking for is to have the system act the same towards one religion as it currently acts towards no religion.
2. Assuming I edit this file properly, how do I put it into a mod?
It is not one of the regular python files under assets, rather, it's under "CvGameCoreDLL", so how do you put it into a mod's folder?
(Oh, like the title says, I'm trying to do this in Warlords)
Thanks for any help!