Error

Linkman226

#anarchy
Joined
Sep 14, 2007
Messages
2,493
When I boot up my game I get the following error:

error.png

Does anyone have any idea what is causing it, or how to fix it?

I haven't modified that .cpp file at all. Which is why I find this bug so puzzling.

EDIT: Also: this only comes up when I have a debug DLL.
 
First thing that popped into my mind is that maybe the XML file might be broken.
But besides that... I'm pretty much clueless as you ;)
 
Otherwise it might be a Civ4BeyondSword.exe corruption.
If anything else fails, try re-installing Beyond the Sword.
 
A failed assert doesn't have to be anything bad. They're only checks to make certain some conditions the programmer thinks need to be fulfilled, but it's entirely possible that the code works anyways. They're ignored unless you run a debug DLL - why did you do that?
 
I just wanted to check out the debugger. I am now back to the regular DLL. However I'm running into a different problem now. For some reason, I don't get a message to switch to the Safavids, and it doesn't give the foreign occupiers are kicked out message. If I try going into the world builder, the game crashes. On top of this, I'm getting repeated messages that the Topkapi palace has been built. The last bug, which I have experienced before is usually because of messed up consts.py values for buildings, but I was sure I already recalibrated those values for the buildings I added.

The only changes I have made since I last ran a working copy was to add a new tuple into consts.py called tTheocraticLeaders that serves the same function as the fascist and communist leader tuples. I also modified Rise and Fall accordingly. I assume the bug is a result of that yet I'm not getting any python exceptions. When I get home I'll do some more investigation, but does anyone have any idea why this might be happening?
 
Might be obvious to you but did you update the constants in CvRhyes.h as well after you've added new buildings?
 
I believe I did. But since it was in the wee hours of the morning I may have forgotten something. I'll check when I get home. On a related note, how come the religions have values in consts.py but not in CvRhyes.h?
 
Apparently the religions are never referenced in the C++ code - or Rhye chose to insert the actual numbers in the rare cases it was necessary. I can't think of one currently, though.
 
I can. Dynamic naming references islam.

I'm asking because I'm planning on adding Shia Islam. It's lot more convenient for me if the instance above is the only instance where religion is mentioned.
 
My usual method for such situations is to simply do it and wait if something goes amiss :D
 
I guess that's what I'll do

EDIT: Offtopic: Mr. Meat and Sarcasm is gone I see.
 
Yeah, it was time for a change and since I'm currently into another reread of The Lies of Locke Lamora ...
 
I see...

Anyways, I isolated the error. The first problem was from tTheocraticLeaders; I'm going to consider that later, but for the time being, I jsut commented it out to pay attention to the second issue:

In my mod, I've included Orion's Inquisition mod, and had no problems until now. The only changes I've made that could be relevant are:

1) I changed the position of the Holy Office Building in the XML

2) I deleted the Holy Offices of some of the religions that Orion had put in

3) I added a religion

4) I added some buildings

So here's the bug:

Code:
Traceback (most recent call last):

  File "CvScreensInterface", line 736, in forceScreenRedraw

  File "CvMainInterface", line 789, in redraw

  File "CvMainInterface", line 1712, in updateSelectionButtons

  File "OIM", line 799, in showInquisitionButton

  File "OIM", line 144, in getReligionInquisitor

  File "OIM", line 129, in getReligionHolyOffice

AttributeError: 'NoneType' object has no attribute 'getPrereqReligion'
ERR: Python function forceScreenRedraw failed, module CvScreensInterface

And the offending bit of code:

Code:
def getReligionHolyOffice(iPlayer, iReligion):
	# Orion's Inquisition Mod
	# Returns the Holy Office Name for the specified Religion
	pPlayer = gc.getPlayer(iPlayer)
	pCivilization = gc.getCivilizationInfo(pPlayer.getCivilizationType())
	
	for iBuildingClass in range(gc.getNumBuildingClassInfos()):
		kBuilding = gc.getBuildingInfo(pCivilization.getCivilizationBuildings(iBuildingClass))
		if kBuilding.getPrereqReligion() == iReligion:			
			iBuilding = pCivilization.getCivilizationBuildings(iBuildingClass)
			#CyInterface().addImmediateMessage("C", "")
			if gc.getBuildingInfo(iBuilding).getSpecialBuildingType() == gc.getInfoTypeForString("SPECIALBUILDING_HOLY_OFFICE"):
				MyHolyOfficeName = gc.getBuildingInfo(iBuilding).getType()
				#CyInterface().addImmediateMessage(str(MyHolyOfficeName), "")
				return MyHolyOfficeName
				break

Any ideas, Leoreth (or others)? I'm pretty sure I know what's going on- namely, that kbuilding is returning a NoneType value. But I'm not sure why :confused::confused:
 
Depends on which players the method is called, I suppose. The independents have some buildings disabled by replacing them with NONE as unique building. Since kBuilding can be a civ's unique building, it's likely it results in NoneType for one of these buildings.

Ways to fix this are to make sure the method doesn't get called on independents or to add another condition before the following code that is "if kBuilding:" (if results false for NoneType, and true for any legitimate object).
 
That gives me this:

Code:
Traceback (most recent call last):

  File "CvScreensInterface", line 736, in forceScreenRedraw

  File "CvMainInterface", line 789, in redraw

  File "CvMainInterface", line 1712, in updateSelectionButtons

  File "OIM", line 805, in showInquisitionButton

  File "OIM", line 159, in getReligionInquisitor

RuntimeError: unidentifiable C++ exception
ERR: Python function forceScreenRedraw failed, module CvScreensInterface

So the getReligionHolyOffice problem is gone. But now I have an unidentifiable C++ exception?
 
Can you post OIM.getReligionInquisitor()?
 
Code:
def getReligionInquisitor(iPlayer, iReligion):
	# Limited Religions
	# Returns the Inquisitor Name for the specified Religion
	pPlayer = gc.getPlayer(iPlayer)
	pCivilization = gc.getCivilizationInfo(pPlayer.getCivilizationType())
	PrereqBuildingName = getReligionHolyOffice(iReligion)
	
	for iUnitClass in range(gc.getNumUnitClassInfos()):
		if gc.getUnitClassInfo(iUnitClass).getMaxPlayerInstances() > 0:
			iUnit = pCivilization.getCivilizationUnits(iUnitClass)
			#iPrereqRel = gc.getUnitInfo(iUnit).getPrereqReligion()
			#if (iPrereqRel >= 0):
			#	if iPrereqRel == iReligion:
			# Look for state Religion Holy Office
			iPrereqBld = gc.getUnitInfo(iUnit).getPrereqBuilding()
			
			if (iPrereqBld >= 0):
				if iPrereqBld == gc.getInfoTypeForString(PrereqBuildingName):
					MyInquisitorName = gc.getUnitInfo(iUnit).getType()
					#CyInterface().addImmediateMessage(str(MyInquisitorName), "")
					return MyInquisitorName
					break
 
What's line 159 exactly?
 
Thanks for your help so far Leoreth- fortunately, with the help of Baldyr, I discovered a better way of fixing the error. I have now circumvented it by customizing OIM for RFC by calling the religious inquisitor value (and all other building/ unit values) from consts.py instead.
 
Top Bottom