The key to your problem is that eReligion and iReligion are two different variables.OK, here is what I've come up with so far. It compiles correctly, but doesn't seem to work:
Code:ReligionTypes eReligion = (ReligionTypes)GC.getBuildingInfo(eBuilding).getFoundsReligion(); if (eReligion != NO_RELIGION) { if (GC.getGameINLINE().isReligionFounded(eReligion)) { return false; } iFounded = 0; for (int iReligion = 0; iReligion < GC.getNumReligionInfos(); ++iReligion) { if (isHolyCity((ReligionTypes)iReligion)) { return false; } if (GC.getGameINLINE().isReligionFounded(eReligion)) { iFounded = iFounded + 1; if (iFounded >= GC.getWorldInfo(GC.getMapINLINE().getWorldSize()).getDefaultPlayers() ) { return false; } } } }
What I aimed to do:
I created an int to track the number of religions founded, iFounded. I defined it as 0, and then in the loop had it add 1 for each founded religion. When iFounded is greater or equal to the DefaultPlayers value from WorldInfos.xml, don't allow any more religions to be founded.
I think my logic is solid, but I suspect I have something in the wrong place.
I want to thank you again for your help; you are giving me just the right amount of help without doing it for me and I appreciate that. Give a man a fish, and all that stuff.![]()
Btw, since it compiled I assume that you declared the iFounded variable somewhere outside the posted part? In C++ you can do it right where you intialise it (which is usually a good idea as that way there is no chance that you accidently use an uninitialised variable).