Historical Accuracy: Relgions

Hmm. It doesn't seem to be working. First, I had the issue with GC.getMaxReligions, as it wasn't a function in CvGlobals, so I added a simple function their. So then it would compile, but I still can get more than my set MaxReligions in the XML.
 
Hmm. It doesn't seem to be working. First, I had the issue with GC.getMaxReligions, as it wasn't a function in CvGlobals, so I added a simple function their. So then it would compile, but I still can get more than my set MaxReligions in the XML.

Wow, I sucked at C++ way back then. I know 20x what I knew then, and I know exactly what the problem here was.

Okay, It looks like this now, and I've set a value of 2 in for duel map size in the XML, but it seems ignore my counter, any idea's why?

Code:
void CvTeam::setHasTech(TechTypes eIndex, bool bNewValue, PlayerTypes ePlayer, bool bFirst, bool bAnnounce)
{
...
 if (bFirst)
            {
                if (GC.getGameINLINE().countKnownTechNumTeams(eIndex) == 1)
                {
                    CyArgsList argsList;
                    argsList.add(getID());
                    argsList.add(ePlayer);
                    argsList.add(eIndex);
                    argsList.add(bFirst);
                    long lResult=0;
                    gDLL->getPythonIFace()->callFunction(PYGameModule, "doHolyCityTech", argsList.makeFunctionArgs(), &lResult);
                    if (lResult != 1)
                    {
                      [COLOR=Red]  int iCounter = 0;
                        for (iI = 0; iI < GC.getNumReligionInfos(); iI++)
                        {
                            if (GC.getGameINLINE().isReligionFounded((ReligionTypes)iI))
                            {
                                iCounter++;
                            }
                        }
                            
                        if (iCounter <= GC.getWorldInfo(GC.getMapINLINE().getWorldSize()).getMaxReligions())
                        {[/COLOR]
                            for (iI = 0; iI < GC.getNumReligionInfos(); iI++)
                            {
                                if (GC.getReligionInfo((ReligionTypes)iI).getTechPrereq() == eIndex)
                                {
                                    iBestValue = MAX_INT;
                                    eBestPlayer = NO_PLAYER;

                                    for (iJ = 0; iJ < MAX_PLAYERS; iJ++)
                                    {
                                        if (GET_PLAYER((PlayerTypes)iJ).isAlive())
                                        {
                                            if (GET_PLAYER((PlayerTypes)iJ).getTeam() == getID())
                                            {
                                                iValue = 10;

                                                iValue += GC.getGameINLINE().getSorenRandNum(10, "Found Religion (Player)");

                                                for (iK = 0; iK < GC.getNumReligionInfos(); iK++)
                                                {
                                                    iValue += (GET_PLAYER((PlayerTypes)iJ).getHasReligionCount((ReligionTypes)iK) * 10);
                                                }

                                                if (GET_PLAYER((PlayerTypes)iJ).getCurrentResearch() != eIndex)
                                                {
                                                    iValue *= 10;
                                                }

                                                if (iValue < iBestValue)
                                                {
                                                    iBestValue = iValue;
                                                    eBestPlayer = ((PlayerTypes)iJ);
                                                }
                                            }
                                        }
                                    }

                                    if (eBestPlayer != NO_PLAYER)
                                    {
                                        GC.getGameINLINE().setReligionSlotTaken((ReligionTypes)iI, true);

                                        if (GC.getGameINLINE().isOption(GAMEOPTION_PICK_RELIGION))
                                        {
                                            if (GET_PLAYER(eBestPlayer).isHuman())
                                            {
                                                CvPopupInfo* pInfo = new CvPopupInfo(BUTTONPOPUP_FOUND_RELIGION, iI);
                                                if (NULL != pInfo)
                                                {
                                                    gDLL->getInterfaceIFace()->addPopup(pInfo, eBestPlayer);
                                                }
                                            }
                                            else
                                            {
                                                ReligionTypes eReligion = GET_PLAYER(eBestPlayer).AI_chooseReligion();
                                                if (NO_RELIGION != eReligion)
                                                {
                                                    GET_PLAYER(eBestPlayer).foundReligion(eReligion, (ReligionTypes)iI, true);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            GET_PLAYER(eBestPlayer).foundReligion((ReligionTypes)iI, (ReligionTypes)iI, true);
                                        }

                                        bReligionFounded = true;
                                        bFirstBonus = true;
                                    }
                                }
                            }
                  [COLOR=Red]      }[/COLOR]
...
 
Have you tried declaring iI as an integer anywhere? I haven't seen it anywhere in the code, so I'm assuming it might be somewhere in the "..." section. I don't see why it would even compile if it wasn't declared, but I've seen compilers do weird stuff.

Code:
                        int iCounter = 0;
                        for (int iI = 0; iI < GC.getNumReligionInfos(); iI++)
                        {
                            if (GC.getGameINLINE().isReligionFounded((ReligionTypes)iI))
                            {
                                iCounter++;
                            }
                        }
                            
                        if (iCounter <= GC.getWorldInfo(GC.getMapINLINE().getWorldSize()).getMaxReligions())
                        {
 
@Afforess thanks for keeping up on this.

I've been thinking about it though, and I think an integer is not the best way to do this. What we really need is is an array, where we can set up declared religions in WorldInfos. If it's blank, the game would load all religions defined in ReligionInfos, however if the array is filled, the game will only load Religions explicitly defined in the WorldInfos file. I think this is the best way to set this up, that way the modmaker can determine a balanced Religion progression, defining the number and specific religions allowed based on map size.

If this does get working as described above, we can put it in the RevDCM core. Such a system, provided it works correctly and is stable, will leave RevDCM unaltered unless the tags are explicitly declared, in which case they'd simply be invaluable modding tools.
 
Have you tried declaring iI as an integer anywhere? I haven't seen it anywhere in the code, so I'm assuming it might be somewhere in the "..." section. I don't see why it would even compile if it wasn't declared, but I've seen compilers do weird stuff.

Code:
                        int iCounter = 0;
                        for (int iI = 0; iI < GC.getNumReligionInfos(); iI++)
                        {
                            if (GC.getGameINLINE().isReligionFounded((ReligionTypes)iI))
                            {
                                iCounter++;
                            }
                        }
                            
                        if (iCounter <= GC.getWorldInfo(GC.getMapINLINE().getWorldSize()).getMaxReligions())
                        {

Yes, all the loop counters are declared up by the function header.

@Afforess thanks for keeping up on this.

I've been thinking about it though, and I think an integer is not the best way to do this. What we really need is is an array, where we can set up declared religions in WorldInfos. If it's blank, the game would load all religions defined in ReligionInfos, however if the array is filled, the game will only load Religions explicitly defined in the WorldInfos file. I think this is the best way to set this up, that way the modmaker can determine a balanced Religion progression, defining the number and specific religions allowed based on map size.

If this does get working as described above, we can put it in the RevDCM core. Such a system, provided it works correctly and is stable, will leave RevDCM unaltered unless the tags are explicitly declared, in which case they'd simply be invaluable modding tools.

Perhaps an array would be best, but Since CvWorldInfo loads WAY before CvReligionInfo, I'd need to do a readpass3. At least I have some experience doing arrays with ReadPass3's.

Before coming back and trying it this way, I had created a function in CvGame, and called it when the game was doing it's final initialization and it would set all but x religion slots as "full" so that no one could found them, but that seemed to cause CTD's, and Religions still got founded anyway...
 
I think you should just abandon the old integer approach to setting a number limit for religions on a map size. Any coding issues you're having with it aside, the concept has the functional problem of leaving the modmaker with no way to spread the set number of religions through the tech tree; which basically means in a mod where there are alot of religions on a small map the only religions that will show up will be the early ones. An array that lets the modmaker set the specific religions they want to allow with map sizes is the only functional way to make this work that I can think of. I remember reading your thread in the SDK forums and dealing with ReadPass3 and ReadPass2 for the Civic Prereqs on buildings, yeah, looks like a lot of work, but at the end of the day I think it'll be worth it to code in this functionality.
 
I think you should just abandon the old integer approach to setting a number limit for religions on a map size. Any coding issues you're having with it aside, the concept has the functional problem of leaving the modmaker with no way to spread the set number of religions through the tech tree; which basically means in a mod where there are alot of religions on a small map the only religions that will show up will be the early ones. An array that lets the modmaker set the specific religions they want to allow with map sizes is the only functional way to make this work that I can think of. I remember reading your thread in the SDK forums and dealing with ReadPass3 and ReadPass2 for the Civic Prereqs on buildings, yeah, looks like a lot of work, but at the end of the day I think it'll be worth it to code in this functionality.

I wasn't trying to persuade you to use an integer, I was just expressing the difficulty I had had in coming up with any solution. I agree, using a boolean array is the better solution.

How does RevDCM achieve it's limited Religions option? That's probably how I need to make my functions look like to work.
 
As far as limited religions in RevDCM works, I don't know. I never use it myself, also it applies to the player and not to the game, so I don't think it'll work for what you want, as you will want to apply the actual functional code to the tech tree. The actual function would need to discriminate out the available number of religions by tech, though the Array in WorldInfos would be set using the religions. The reason this would be the preffered method should be obvious, as it would allow the modmaker to functionally limit the number of religions and when they appear in the tech tree, while still allowing the player to choose their religion if they pick that gameoption as well as allowing scenario makers and cheaters to do as they please with religions in WB.
 
I don't know anything about programming, so can't help you in the slightest, but just wanted to offer my support for the idea of more religions (since I always play on Huge maps ;) )!
 
sucks that this idea was left in the dust,
 
The mass majority of revolutions have had very little to do with religion. The Dutch revolt (any ethnic revolt, really), the Belgium revolution, the mass majority of peasent revolution, the Greek Communist Revolt, all of the 1848 Revolts and the revolts after the Great War, even the Russian Revolution had only a small bit to do with religion (that you suggest it was a major factor shows that you should study up on it again).

Schisms should not be treated as 'different religions'. I think that they should still get the 'we care for our brothers and sisters in the faith' modifier, but also a 'we damn you for believeing in a different interrupitation' modifier, and that modifier should change depending on how strong/weak the schism is, and how the two schisms have historically gotten along. Events could be made to strengthen/weaken that modifier- much like how today Catholics and Protestants would have a + to their relationship, while in the Reformation that would not be the case.
 
Top Bottom