• Our friends from AlphaCentauri2.info are in need of technical assistance. If you have experience with the LAMP stack and some hours to spare, please help them out and post here.

Adding new Resource Yields to Future Techs

Your problem is almost definitely in CvGameTextMgr.cpp.

But creating the list of buildings doesn't require accessing the popup text AFAIK. The exception happens while the list is being created, and that should require only the translated name and icon.

Actually, sorting the buildings requires only the names and accessing the building info itself, so it's more likely that one of the buildings you added isn't complete or has some problem with it.
 
  1. OK, so, CivIV loads fine to its main screen.
  2. From the main screen, the Pedia does not load either the Buildings or Wonders pages.
  3. Going from the Tech page (or any other), mousing over a Building or Wonder icon cause an instant CTD. This leaves an empty PythonErr.log.
  4. Starting an individual game works fine, I can move units around and all. Settling a city allows me to select a name for that city, and when that popup goes away the game CTD's. So, the Building List popup, which would be next, does not load.
  5. EF, I have not at this point added any new buildings to the game that didn't work fine before. I have a number of new Wonders (most of them modeled after work of Tsentom1's), but those have all been thoroughly tested in actual play and have not caused issues.

So, whatever it is is from my C++ code trying to add a new tag to CIV4ReligionInfo.xml that will allow the Shrines to produce Yields as well as Commerces.
 
Building the Pedia page doesn't NEED to load all of the information for the buildings, but it DOES load it. Somewhat annoying, but also occasionally useful for finding precisely which building has the error.

Draco: Comment out any changes you made in CvGameTextManager.cpp and see if that helps. It is really sounding quite likely that it shall. Errors elsewhere in your code should have caused problems loading the entire game, or when processing the specific building, but a GTM error affects every building if the error isn't tucked away inside an IF statement which is working properly.
 
OK, finally making some progress.

One of our previous debugging attempts, when nothing had shown up at all (because I was a twerp and was copying the DLL to the wrong dir) was to change the IF statement for my new Yields in CGTM.cpp. So, put that back to "NO_RELIGION" instead of "false", and the Buildings & Wonders pages load again. But, my IF statement isn't being seen. So, now to the Debugging, I think...

Here's what the code looks like (my changes bold):
Code:
[B]	if (kBuilding.getGlobalReligionYield() != NO_RELIGION)
	{
		szBuffer.append(gDLL->getText("About to check IF (getGlobalReligionYield (%d) != NO_RELIGION (-1))", kBuilding.getGlobalReligionYield()));
		szFirstBuffer = gDLL->getText("TXT_KEY_BUILDING_PER_CITY_WITH", GC.getReligionInfo((ReligionTypes) kBuilding.getGlobalReligionYield()).getChar());
		setYieldChangeHelp(szBuffer, L"", L"", szFirstBuffer, GC.getReligionInfo((ReligionTypes) kBuilding.getGlobalReligionYield()).getGlobalReligionYieldArray());
	}[/B]

	if (kBuilding.getGlobalReligionCommerce() != NO_RELIGION)
	{
		[B]szBuffer.append(gDLL->getText("About to check IF (getGlobalReligionCommerce (%d) != NO_RELIGION (-1))", kBuilding.getGlobalReligionCommerce()));[/B]
		szFirstBuffer = gDLL->getText("TXT_KEY_BUILDING_PER_CITY_WITH", GC.getReligionInfo((ReligionTypes) kBuilding.getGlobalReligionCommerce()).getChar());
		setCommerceChangeHelp(szBuffer, L"", L"", szFirstBuffer, GC.getReligionInfo((ReligionTypes) kBuilding.getGlobalReligionCommerce()).getGlobalReligionCommerceArray());
	}

The extra text line for getGlobalReligionCommerce does work, it displays that it's checking for that string and then shows the expected data, but the "test" text string for my Yields IF does bubkus. Oh, the heck with explaining it, here's a screenie:
attachment.php
 

Attachments

  • PediaScreenShot0002.JPG
    PediaScreenShot0002.JPG
    16.7 KB · Views: 128
You need to put the text line addition outside of the if() test for it to always show. Right now the test is failing (it == NO_RELIGION), so you text doesn't appear.

Also, this seems to work, but you normally only use getText() when you have an XML <TEXT> key that you want to look up. To format text in a raw string, use Format().

Code:
	[B]CvWString szTempBuffer;[/B] // remove this declaration if it's already in the function above
	...
	[B]szTempBuffer.Format(NEWLINE L"About to check IF (getGlobalReligionYield (%d) != NO_RELIGION (-1))", kBuilding.getGlobalReligionYield());
	szBuffer.append(szTempBuffer);[/B]
	if (kBuilding.getGlobalReligionYield() != NO_RELIGION)
	{
		szFirstBuffer = gDLL->getText("TXT_KEY_BUILDING_PER_CITY_WITH", GC.getReligionInfo((ReligionTypes) kBuilding.getGlobalReligionYield()).getChar());
		setYieldChangeHelp(szBuffer, L"", L"", szFirstBuffer, GC.getReligionInfo((ReligionTypes) kBuilding.getGlobalReligionYield()).getGlobalReligionYieldArray());
	}

	[B]szTempBuffer.Format(NEWLINE L"About to check IF (getGlobalReligionCommerce (%d) != NO_RELIGION (-1))", kBuilding.getGlobalReligionCommerce());
	szBuffer.append(szTempBuffer);[/B]
	if (kBuilding.getGlobalReligionCommerce() != NO_RELIGION)
	{
		szFirstBuffer = gDLL->getText("TXT_KEY_BUILDING_PER_CITY_WITH", GC.getReligionInfo((ReligionTypes) kBuilding.getGlobalReligionCommerce()).getChar());
		setCommerceChangeHelp(szBuffer, L"", L"", szFirstBuffer, GC.getReligionInfo((ReligionTypes) kBuilding.getGlobalReligionCommerce()).getGlobalReligionCommerceArray());
	}
 
Hmm... Interesting effects...

So I tried a couple of different things. Your suggested code EF, causes the text statements to both show up under the same bullet-point in the Pedia, and then shows the Commerce changes; but Yields still do not show up. I then tried moving the szTempBuffer and szBuffer statements inside the IF statement, which brought me right back to what I had before, in post #224.

I also tried both with the same text statements that I was using before, and the effect was the same. If the text statement is outside the IF, then both show, but there is no Yield functionality. If the text statements are inside the IFs, then only the Commerce text shows up.

So, from this, I think I conclude that there is something wrong with my Yield IF statement. Not just the contents of it, but the check itself. I'm double-checking spelling next to make sure I didn't do something stupid.
 
The way I coded it, it should tell you that it is about to check the value and show you the value itself. If the value is not equal to NO_RELIGION, it should then show another line with the additional yields. Can you be more specific about what output your seeing? Perhaps post a screenshot.
 
Here's what your code example results in, EF:

attachment.php
attachment.php
attachment.php


So, the testing text shows up on everything, because it is outside of an IF statement, it just gets run all the time, but there is no result from my IF statement. Hope that helps clarify things. I should'a just included these the first time... :crazyeye:
 

Attachments

  • PediaScreenShot0003.JPG
    PediaScreenShot0003.JPG
    17.6 KB · Views: 119
  • PediaScreenShot0004.JPG
    PediaScreenShot0004.JPG
    20.2 KB · Views: 119
  • PediaScreenShot0005.JPG
    PediaScreenShot0005.JPG
    20 KB · Views: 122
It looks like everything is working perfectly; what am I missing? Your if() test checks to see if getGlobalReligionYield() returns something other than NO_RELIGION. Since that function returns NO_RELIGION in every case you showed, no yields are shown. This is how it should operate.

What are you expecting to see?

It would help to see the XML you added for one of the shrines. I suspect you have yields specified but not the religion for which they apply.
 
Your IF statement works fine. The test is telling you that it is checking for:

-1 != -1

Which of course is not true, because they ARE equal.


So for each of the three buildings you showed, getGlobalReligionYield() is saying that there is none assigned. If any of these 3 should have had such a value, then the XML isn't loading properly.

EDIT: Doh, I open threads way before I read them, makes me get majorly ninja'd sometimes :p
 
umm... Guys, I must be missing something vital, cause I don't understand how what's happening is making sense to the two of you... :wallbash:

Here is the code in use for the above pics (exactly as you gave it to me before EF):
Code:
    szTempBuffer.Format(NEWLINE L"About to check IF (getGlobalReligionYield (%d) != NO_RELIGION (-1))", kBuilding.getGlobalReligionYield());
    szBuffer.append(szTempBuffer);
    if (kBuilding.getGlobalReligionYield() != NO_RELIGION)
    {
        szFirstBuffer = gDLL->getText("TXT_KEY_BUILDING_PER_CITY_WITH", GC.getReligionInfo((ReligionTypes) kBuilding.getGlobalReligionYield()).getChar());
        setYieldChangeHelp(szBuffer, L"", L"", szFirstBuffer, GC.getReligionInfo((ReligionTypes) kBuilding.getGlobalReligionYield()).getGlobalReligionYieldArray());
    }

    szTempBuffer.Format(NEWLINE L"About to check IF (getGlobalReligionCommerce (%d) != NO_RELIGION (-1))", kBuilding.getGlobalReligionCommerce());
    szBuffer.append(szTempBuffer);
    if (kBuilding.getGlobalReligionCommerce() != NO_RELIGION)
    {
        szFirstBuffer = gDLL->getText("TXT_KEY_BUILDING_PER_CITY_WITH", GC.getReligionInfo((ReligionTypes) kBuilding.getGlobalReligionCommerce()).getChar());
        setCommerceChangeHelp(szBuffer, L"", L"", szFirstBuffer, GC.getReligionInfo((ReligionTypes) kBuilding.getGlobalReligionCommerce()).getGlobalReligionCommerceArray());
    }

Now, the TEXT statements are outside the IF statements. And as I understand it, that means they are not actually doing anything. The game just comes across a TEXT statement in the Buildings portion of CGTM.cpp, and so we get a TEXT line on all the building and Wonder floats in the Pedia. Here's another example, with the content of the TEXT line changed a bit ;):

attachment.php
attachment.php
attachment.php





Now, when we put the TEXT statements inside the IF statements, comme ça:
Code:
    if (kBuilding.getGlobalReligionYield() != NO_RELIGION)
    {
 [B]       szTempBuffer.Format(NEWLINE L"[COLOR="Red"]This TEXT line tests for Yields,[/COLOR]", kBuilding.getGlobalReligionYield());
        szBuffer.append(szTempBuffer);[/B]
        szFirstBuffer = gDLL->getText("TXT_KEY_BUILDING_PER_CITY_WITH", GC.getReligionInfo((ReligionTypes) kBuilding.getGlobalReligionYield()).getChar());
        setYieldChangeHelp(szBuffer, L"", L"", szFirstBuffer, GC.getReligionInfo((ReligionTypes) kBuilding.getGlobalReligionYield()).getGlobalReligionYieldArray());
    }

    if (kBuilding.getGlobalReligionCommerce() != NO_RELIGION)
    {
[B]        szTempBuffer.Format(NEWLINE L"[COLOR="Red"]and this TEXT line tests for Commerce.[/COLOR]", kBuilding.getGlobalReligionCommerce());
        szBuffer.append(szTempBuffer);[/B]
        szFirstBuffer = gDLL->getText("TXT_KEY_BUILDING_PER_CITY_WITH", GC.getReligionInfo((ReligionTypes) kBuilding.getGlobalReligionCommerce()).getChar());
        setCommerceChangeHelp(szBuffer, L"", L"", szFirstBuffer, GC.getReligionInfo((ReligionTypes) kBuilding.getGlobalReligionCommerce()).getGlobalReligionCommerceArray());
    }
and run the game with the code like that, we now get this:

attachment.php
attachment.php
attachment.php


So, no TEXT lines on buildings or non-religious Wonders, and only the second TEXT line, the Commerce line, on the Shrines. Which, to me, proves that the game is not reading the first IF statement.

Am I wrong about this?

Oh, it's also not that the game is checking everything correctly and I didn't remember to enter values in the XML. I've got them, 2 of everything, just to make sure I see it when I get it working. Here's a complete fileset: View attachment Array.rar.

Thanks again guys! :D
 

Attachments

  • PediaScreenShot0008.JPG
    PediaScreenShot0008.JPG
    15.3 KB · Views: 117
  • PediaScreenShot0007.JPG
    PediaScreenShot0007.JPG
    12.7 KB · Views: 114
  • PediaScreenShot0006.JPG
    PediaScreenShot0006.JPG
    15.7 KB · Views: 118
  • PediaScreenShot0009.JPG
    PediaScreenShot0009.JPG
    12.4 KB · Views: 111
  • PediaScreenShot0010.JPG
    PediaScreenShot0010.JPG
    9.7 KB · Views: 118
  • PediaScreenShot0011.JPG
    PediaScreenShot0011.JPG
    14.1 KB · Views: 115
umm... Guys, I must be missing something vital, cause I don't understand how what's happening is making sense to the two of you... :wallbash:

I'll try to break it down a bit then

Here is the code in use for the above pics (exactly as you gave it to me before EF):
Code:
    szTempBuffer.Format(NEWLINE L"About to check IF (getGlobalReligionYield (%d) != NO_RELIGION (-1))", kBuilding.getGlobalReligionYield());

I'm stopping here because this is the text output you are seeing, and apparently what you don't understand as being as beautifully helpful as it is.

It literally says:

-----------------------

Make szTempBuffer hold some information for me, m'Kay? And it's gonna look purdy, so translate this stuff special like.

First, get me on a new line away from the previous drivel. Then write exactly this:

About to check IF (getGlobalReligionYield (

Now at this point, STOP and check out a number in the code for me, will you? It'll be an integer, I'll tell you which integer in a moment. Once you print that number, then write exactly this:

) != NO_RELIGION (-1))

Now, that number to squeeze between those two statements I want you to write? You can find it by checking out kBuilding.getGlobalReligionYield(). Whatever that function answers you with, print it in between those two statements, then go back to running the rest of the code like normal.

--------------------

That is the only piece of the entire puzzle that we are really looking at, because it is the only part which actually happens right now, and it performs the job properly. Since in the screenshot you posted, that %d got replaced with a -1, we know that the function is always returning to you with a NO_RELIGION. Thus the next IF check does exactly what it is designed to do and DOESN'T RUN, because it does not see any reason to do so.


So the error in your code is somewhere in CvInfos, or in your XML. We need to see both of those to help any more really. I tend to be a tad too lazy to look through attached code files since normally there are only a couple of relevant lines and finding them can be a PITA if you don't know the code yourself. Just show us the XML for a building which makes use of this function so we can see if there is a typo involved, and show us the CvInfos functions to read the XML, and again to respond to queries.



EDIT:

Ok, I decided to look at your attached files anyway. You don't include your BuildingInfos.xml file, so I am going to assume that you forgot to add your new field to any buildings, because I remember you hinting earlier that you didn't need to add anything to them. You do need to though.

Some buildings already have a line like:

<GlobalReligionCommerce>RELIGION_ISLAM</GlobalReligionCommerce>

And so they work great with commerces. But you want them to work with Yields now, so need to use the new field which you added yourself

<GlobalReligionYield>RELIGION_ISLAM</GlobalReligionYield>

Once you do that, things should start to work beyond the point where they currently break down.
 
xienwolf laid it out pretty well, but I think this statement might be a little unclear:

Thus the next IF check does exactly what it is designed to do and DOESN'T RUN, because it does not see any reason to do so.

I know what he means, but I want to avoid any confusion. In this code

Code:
if (kBuilding.getGlobalReligionYield() != NO_RELIGION)
{
    ... add line to hover text ...
}

The if() part is evaluated, and the result is false. Thus, the part in { ... } is skipped because that's what if() tests do. The previous screenshots you posted proved that

Code:
kBuilding.getGlobalReligionYield()

returns -1 (NO_RELIGION) for the shrine in the screenshot. "-1 != -1" is false. I don't know how to explain that any more deeply. "!=" means "not equal to", and every int is equal to itself.

Bottom line: The if() test is running, and it is correctly detecting that the building has NO_RELIGION specified for its GlobalReligionYield.
 
Oh for... :wallbash: :hammer2:
%@$@ #*%^ $@#!-@^$%! @!%$ &*%$@#!!!!

-ahem-

'Scuse me, sorry for the profanity. I needed to vent a bit, as it appears I suffer from a terminal case of blindus idiotis. -sigh- :blush:

Alright, I now understand that the TEXT statements were themselves functioning code, and not just "Print this here" commands. I hadn't even noticed the change of %d to -1 in the printouts. I'm sorry for being so thick on getting the point.

Moving forward: Xienwolf, you are absolutely correct about what I was missing, it was a GlobalReligionYield tag in BuildingInfos. It never even occured to me that I needed one! Once you pointed it out, of course, I had another -Duh!- moment. ... that seems to be happening alot lately.

Guys I'm so sorry for being so hard to teach... yeesh...

attachment.php
Well, at least it works now. I'm going to use the Palace as the model for incorporating ReligionYields Commerce (Yield #3) into the city total. I think I'm going to have to copy Specialists to get Food & Hammers working.
 

Attachments

  • PediaScreenShot0012.JPG
    PediaScreenShot0012.JPG
    17.9 KB · Views: 109
OK, so this doesn't work, it caused a CTD when I tried to found a city.

Code:
[I]all in CvCity.cpp[/I]

void CvCity::doTurn()
		-etc-
			for (iJ = 0; iJ < GC.getNumBuildingInfos(); iJ++)
			{
				iCount += getNumActiveBuilding((BuildingTypes)iJ) * (GC.getBuildingInfo((BuildingTypes) iJ).getYieldChange(iI) + getBuildingYieldChange((BuildingClassTypes)GC.getBuildingInfo((BuildingTypes) iJ).getBuildingClassType(), (YieldTypes)iI));
			}
[B]			iCount += getReligionYields((YieldTypes)iI);[/B]
			iCount += getTradeYield((YieldTypes)iI);
			iCount += getCorporationYield((YieldTypes)iI);

			FAssert(iCount == getBaseYieldRate((YieldTypes)iI));
		}

			-etc-

void CvCity::updateReligionCommerce()
		-etc-
[B]int CvCity::getReligionYields(YieldTypes eIndex) const
{
	FAssertMsg(eIndex >= 0, "eIndex expected to be >= 0");
	FAssertMsg(eIndex < NUM_YIELD_TYPES, "eIndex expected to be < NUM_YIELD_TYPES");
	return m_aiReligionYield[eIndex];
}[/B]
int CvCity::getCorporationYield(YieldTypes eIndex) const
 
This means that m_aiReligionYield hasn't been initialized and points to NULL. Where do you create the array to hold the values?
 
Sorry EF, you know what you're doing and talking about, and I'm still flailing around here. Your first sentence I understood (thank heavens), so I know I missed something that tells the game what m_aiReligionYield is (or what value it has). But although I know the array will be something telling the game exactly that, I don't know what an array is, or what it should look like so that I may track one down and emulate it.

What I did for the above was basically just copy all references of m_aiReligionCommerce. There're 7 instances of that string in CvCity.cpp, and I mimic'd each of them EXCEPT void CvCity::updateReligionCommerce(CommerceTypes eIndex).

That's the one I'm missing, isn't it? Thing is, it didn't look right for what I'm trying to do...
Code:
void CvCity::updateReligionCommerce(CommerceTypes eIndex)
{
	int iNewReligionCommerce;
	int iI;

	iNewReligionCommerce = 0;

	for (iI = 0; iI < GC.getNumReligionInfos(); iI++)
	{
		iNewReligionCommerce += getReligionCommerceByReligion(eIndex, ((ReligionTypes)iI));
	}

	if (getReligionCommerce(eIndex) != iNewReligionCommerce)
	{
		m_aiReligionCommerce[eIndex] = iNewReligionCommerce;
		FAssert(getReligionCommerce(eIndex) >= 0);

		updateCommerce(eIndex);
	}
}
I'll have to edit it massively so that it counts each city with the religion, right?
 
What I'm looking for is that you have a line like this in CvCity::CvCity() -- what's called the CvCity class's constructor.

Code:
m_aiReligionYield = new int[NUM_YIELD_TYPES];

This initializes the array field by creating an array (new int[NUM_YIELD_TYPES]) and assigning it to m_aiReligionYield. That way when you try to access it in the code above (m_aiReligionYield[eYield]) you get a value instead of a crash.

If you copied all places where you found m_aiReligionCommerce, you probably have the above line. I don't see any other reason for it to fail short of passing in the wrong index type (a CommerceTypes instead of a YieldTypes).

Regarding the updateReligionCommerce() function, cities track commerce and yield values differently, not just that they are in different arrays, but that yields are more static than commerce because the commerce values have to be recalculated every time you change the sliders.

But looking at the code more, you'll probably want to pattern this off of how corporations are handled. Each corporation can supply yields to the city. You can see in updateCorporation() calls to updateCorporationYield() and updateCorporationCommerce(). You should add

Code:
updateReligionHappiness();
[B]updateReligionYield();[/B]
updateReligionCommerce();

to setHasReligion() and write updateReligionYield() much like updateReligionCommerce(). Pattern it after updateCorporationYield(); it should be nearly identical.
 
I just noticed some handy debugging code in CvCity::doTurn(). It calculates the total yield for the city and compares it to its internally stored running total. It's cool because it's the only place I've found that runs through the full calculation. I mention it here because it's handy, but you should also add your religion yield near the end:

Code:
for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
{
	FAssert(getBaseYieldRate((YieldTypes)iI) >= 0);
	FAssert(getYieldRate((YieldTypes)iI) >= 0);

	iCount = 0;

	for (iJ = 0; iJ < NUM_CITY_PLOTS; iJ++)
	{
		if (isWorkingPlot(iJ))
		{
			pPlot = getCityIndexPlot(iJ);

			if (pPlot != NULL)
			{
				iCount += pPlot->getYield((YieldTypes)iI);
			}
		}
	}

	for (iJ = 0; iJ < GC.getNumSpecialistInfos(); iJ++)
	{
		iCount += (GET_PLAYER(getOwnerINLINE()).specialistYield(((SpecialistTypes)iJ), ((YieldTypes)iI)) * (getSpecialistCount((SpecialistTypes)iJ) + getFreeSpecialistCount((SpecialistTypes)iJ)));
	}

	for (iJ = 0; iJ < GC.getNumBuildingInfos(); iJ++)
	{
		iCount += getNumActiveBuilding((BuildingTypes)iJ) * (GC.getBuildingInfo((BuildingTypes) iJ).getYieldChange(iI) + getBuildingYieldChange((BuildingClassTypes)GC.getBuildingInfo((BuildingTypes) iJ).getBuildingClassType(), (YieldTypes)iI));
	}

	iCount += getTradeYield((YieldTypes)iI);
	iCount += getCorporationYield((YieldTypes)iI);
	[B]iCount += getReligionYield((YieldTypes)iI);[/B]

	FAssert(iCount == getBaseYieldRate((YieldTypes)iI));
}
 
OK, I've got a line inserted in the debugging section, but I don't know how to use it. Here's what I've entered into CvCity.cpp right before int CvCity::getCorporationYield(YieldTypes eIndex) const:
Code:
int CvCity::getReligionYields(YieldTypes eIndex) const
{
	FAssertMsg(eIndex >= 0, "eIndex expected to be >= 0");
	FAssertMsg(eIndex < NUM_YIELD_TYPES, "eIndex expected to be < NUM_YIELD_TYPES");
	return m_aiReligionYields[eIndex];
}


void CvCity::setReligionYields(YieldTypes eIndex, int iNewValue)
{
	int iOldValue;

	FAssertMsg(eIndex >= 0, "eIndex expected to be >= 0");
	FAssertMsg(eIndex < NUM_YIELD_TYPES, "eIndex expected to be < NUM_YIELD_TYPES");

	iOldValue = getReligionYields(eIndex);

	if (iOldValue != iNewValue)
	{
		m_aiReligionYields[eIndex] = iNewValue;
		FAssert(getReligionYields(eIndex) >= 0);

		changeBaseYieldRate(eIndex, (iNewValue - iOldValue));
	}
}


int CvCity::getReligionYieldsByReligion(YieldTypes eIndex, ReligionTypes eReligion) const
{
	int iYield;

	FAssertMsg(eIndex >= 0, "eIndex expected to be >= 0");
	FAssertMsg(eIndex < NUM_YIELD_TYPES, "eIndex expected to be < NUM_YIELD_TYPES");
	FAssertMsg(eReligion >= 0, "eReligion expected to be >= 0");
	FAssertMsg(eReligion < GC.getNumReligionInfos(), "GC.getNumReligionInfos expected to be >= 0");

	iYield = 0;

	if ((GET_PLAYER(getOwnerINLINE()).getStateReligion() == eReligion) || (GET_PLAYER(getOwnerINLINE()).getStateReligion() == NO_RELIGION))
	{
		if (isHasReligion(eReligion))
		{
			iYield += GC.getReligionInfo(eReligion).getStateReligionCommerce(eIndex);

			if (isHolyCity(eReligion))
			{
				iYield += GC.getReligionInfo(eReligion).getHolyCityCommerce(eIndex);
			}
		}
	}

	return iYield;
}


void CvCity::updateReligionYields(YieldTypes eIndex)
{
	int iOldYield = getReligionYields(eIndex);
	int iNewYield = 0;

	for (int iI = 0; iI < GC.getNumReligionInfos(); iI++)
	{
		iNewYield += getReligionYieldsByReligion(eIndex, (ReligionTypes)iI);
	}

	if (iOldYield != iNewYield)
	{
		m_aiReligionYields[eIndex] = iNewYield;
		FAssert(getReligionYields(eIndex) >= 0);

		changeBaseYieldRate(eIndex, (iNewYield - iOldYield));
	}
}

I've attempted to make a hybrid of GetCorporationYield & GetReligionCommerce. It doesn't work, still causes a complete freeze. :( Hoping you could take a look through it before I start trying to learn how to use the breakpoints...

Thanks guys...
 
Back
Top Bottom