Mod crashes

Whoops. As it turns out, my troubles are far from over. When I tried testing a new Inquisitor unit, I got this message:

attachment.php


Here's the relevant line in the PythonDbg file:

Code:
UnitClass: CHANGED_TXT_KEY_UNIT_EXECUTIVE_2, UnitType: 13

UnitClass: Dinoco Executive, UnitType: 14

UnitClass: A.C.M.E. Executive, UnitType: 15

UnitClass: Cyberdyne Executive, UnitType: 16

UnitClass: Black Mesa Executive, UnitType: 17

UnitClass: Mooby Executive, UnitType: 18

UnitClass: Jewish Missionary, UnitType: 19

UnitClass: Christian Missionary, UnitType: 20

UnitClass: Islamic Missionary, UnitType: 21

UnitClass: Hindu Missionary, UnitType: 22

UnitClass: Buddhist Missionary, UnitType: 23

UnitClass: Confucian Missionary, UnitType: 24

UnitClass: Taoist Missionary, UnitType: 25

UnitClass: Martian Missionary, UnitType: 27
 

Attachments

  • Civ4ScreenShot0270.JPG
    Civ4ScreenShot0270.JPG
    96.4 KB · Views: 139
Repost your OIM module one more time, because otherwise we can't know that exactly has changed or how the key line 189 reads. (Hint: the last entry in the Traceback is where the exception happens.)

I also believe that I asked you to remove those print lines, because we're not debugging the same problem any more (or so I would expect).
 
Here it is:
 

Attachments

Ok, lets see. Line #189 contains this statement:
if iPrereqBld == gc.getInfoTypeForString(PrereqBuildingName):
The "unidentifiable C++ exception" is no doubt coming from the getInfoTypeForString() method that is really found in the SDK but exposed to Python. The name PrereqBuildingName needs to be a valid string value for the method invocation to be valid, so my best guess is that its some other type. Most likely the None type. The PrereqBuildingName variable is defined on line #174:
PrereqBuildingName = getReligionHolyOffice(iPlayer, iReligion)
getReligionHolyOffice() if a function found in the OIM module and should return a string value, but I guess not:
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 != None:
		# Look for Prerequisite Religion
				
			if kBuilding.getPrereqReligion() != -1:
			
				iHOPrereqRel = kBuilding.getPrereqReligion()
			
				#if (iHOPrereqRel >= 0):		
				if iHOPrereqRel == 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
The return statement at the second last line is where the string value is supposed to come from. But unless the code never reaches the function will just return a default None value. So this is probably what is happening.

Once again I would like you to check your XML, because the Inquisitor mod was hardly written with your specific mod in mind. But lets debug it by adding print statements:
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())

[COLOR="Red"]	print "Scanning getReligionHolyOffice()... Player: " + str(iPlayer) + ", Religion: " + str(iReligion)[/COLOR]
	
	for iBuildingClass in range(gc.getNumBuildingClassInfos()):
		kBuilding = gc.getBuildingInfo(pCivilization.getCivilizationBuildings(iBuildingClass))

[COLOR="Red"]		print "current Building Class: " + gc.getBuildingClassInfo(iBuildingClass).getDescription() + ", current Building: " + kBuilding.getDescription()[/COLOR]
		
		if kBuilding != None:
		# Look for Prerequisite Religion
				
			if kBuilding.getPrereqReligion() != -1:
			
				iHOPrereqRel = kBuilding.getPrereqReligion()
			
				#if (iHOPrereqRel >= 0):		
				if iHOPrereqRel == 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
Run the mod again and try to replicate the exception. Once you do, post your PythonDbg.log - the last entry should be the defunct building.
 
You know the drill.
Code:
Scanning getReligionHolyOffice()... Player: 0, Religion: 7

current Building Class: Palace, current Building: Palace

current Building Class: Camelot, current Building: Camelot
 
Well, as always, the culprit is the last entry, because the script exits here. In this case "Camelot". Something about the XML settings of that building/class isn't making any sense in the context of the Inquisitor mod. Could you please look if its all in order, or if there is something there that could perhaps be changed to a more "normal" state?

I'm worried about your mod simply including so much non-standard XML stuff that using the Inquisitor mod as-is will be more work than to simply rewrite the whole thing from scratch... :p Like Camelot is only the second building - how many of these weird things will there be?
 
Damn you, cfkane.
 
My guess is that it is essentially the same issue. This one line of code:
Code:
kBuilding = gc.getBuildingInfo(pCivilization.getCivilizationBuildings(iBuildingClass))
If there is no building type for the class (i.e. NONE) for that civ this one-liner will fail due to the getBuildingInfo being passed a -1.

Split it into two lines and check the return of getCivilizationBuildings before using it.

This would actually make it the building after the last one reported since it would fail just before the print statement.
 
I guess like this:
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()):
[COLOR="Red"]		iCivBuilding = pCivilization.getCivilizationBuildings(iBuildingClass)
		if iCivBuilding == -1: continue
		kBuilding = gc.getBuildingInfo(iCivBuilding)[/COLOR]		
		
		if kBuilding != None:
		# Look for Prerequisite Religion
				
			if kBuilding.getPrereqReligion() != -1:
			
				iHOPrereqRel = kBuilding.getPrereqReligion()
			
				#if (iHOPrereqRel >= 0):		
				if iHOPrereqRel == 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
 
I eventually deleted my mod and started the whole thing from scratch, using Tsentom's Inquisition Project. Everything's working fine... except that the Doctor seems to have been waylaid by the Inquisition.

attachment.php


I've noticed that the TARDIS no longer appears in cities.

Here's the error log:

Code:
12 SCREEN TURNED ON

I uploaded the two probable culprit files:
 

Attachments

On line #1230, "pUnit" should really be "unit":
if not gc.getPlayer(unit.getOwner()).isHuman( ):
 
For which file?
 
Well, the exception concerns CvEventManager.py, right? The error occurred on line 1230 - it says so in plain English. You're actually supposed to read the traceback. And you can also find it in the Python Error Log, so you don't need to capture the in-game pop-up. Instead, you can simply copy-paste the plain text version into your post.
 
Back
Top Bottom