CIVILIZATION IV:iNoc

mmhh...and if there are no errors...then it has to mean that your new addition somehow prevents that the part, which places that text, is executed. Might be some faulty logic, a wrong elif, or whatever in the code.

If you could show as a bit the surrounding of your modification...
 
I can't find much time for modding at the moment as I am addicted to a drug and trying to find a clinic. Unfortunatly, I don't think any Dwarf Fortress rehab clinics exist. Yet.

Oh, and Newt Gingrich might be suing me.
 
Ok, my mysterious caller may or may not be calling me back, so while I'm not panicking, I'll post this:

SevoPediaCivilization.py; the whole thing:
Code:
# Sid Meier's Civilization 4
# Copyright Firaxis Games 2005

#
# Sevopedia 2.3
#   sevotastic.blogspot.com
#   sevotastic@yahoo.com
#
# additional work by Gaurav, Progor, Ket, Vovan, Fitchn, LunarMongoose
# see ReadMe for details
#
#Modified by Voyhkah for iNoc

from CvPythonExtensions import *
import CvUtil
import ScreenInput
import SevoScreenEnums

gc = CyGlobalContext()
ArtFileMgr = CyArtFileMgr()
localText = CyTranslator()

class SevoPediaCivilization:

	def __init__(self, main):
		self.iCivilization = -1
		self.top = main

		self.X_MAIN_PANE = self.top.X_PEDIA_PAGE
		self.Y_MAIN_PANE = self.top.Y_PEDIA_PAGE

		self.Y_TECH = self.Y_MAIN_PANE
		self.H_TECH = 110

		self.Y_LEADER = self.Y_TECH + self.H_TECH + 10
		self.H_LEADER = 110

		self.H_MAIN_PANE = self.Y_LEADER + self.H_LEADER - self.Y_MAIN_PANE
		self.W_MAIN_PANE = self.H_MAIN_PANE

		self.X_TECH = self.X_MAIN_PANE + self.W_MAIN_PANE + 10
		self.W_TECH = self.top.R_PEDIA_PAGE - self.X_TECH
		
		self.X_LEADER = self.X_TECH
		self.W_LEADER = self.top.R_PEDIA_PAGE - self.X_TECH

		self.W_ICON = 150
		self.H_ICON = 150
		self.X_ICON = self.X_MAIN_PANE + (self.H_MAIN_PANE - self.H_ICON) / 2
		self.Y_ICON = self.Y_MAIN_PANE + (self.H_MAIN_PANE - self.H_ICON) / 2
		self.ICON_SIZE = 64

		self.X_BUILDING = self.X_MAIN_PANE
		self.Y_BUILDING = self.Y_LEADER + self.H_LEADER + 10
		self.W_BUILDING = 130
		self.H_BUILDING = 110

		self.X_UNIT = self.X_BUILDING + self.W_BUILDING + 10
		self.Y_UNIT = self.Y_BUILDING
		self.W_UNIT = ((self.top.R_PEDIA_PAGE - self.X_UNIT) / 2) -10
                                ###^^Voyhkah Tweak^^###
		self.H_UNIT = 110

###Voyhkah Tweak START###
		self.X_TEXT = ((self.top.R_PEDIA_PAGE - self.top.X_PEDIA_PAGE) / 2) + self.top.X_PEDIA_PAGE + 5
		self.Y_TEXT = self.Y_BUILDING + self.H_BUILDING + 10
		self.W_TEXT = (self.top.R_PEDIA_PAGE - self.top.X_PEDIA_PAGE) / 2
		self.H_TEXT = self.top.B_PEDIA_PAGE - self.Y_TEXT
		
		self.X_TRAITS = self.X_MAIN_PANE
		
###Tweak END###

###Voyhkah Tweak START###

		self.X_DOUBLE_SPEED_TECHS = self.X_UNIT + self.W_UNIT + 20
		self.Y_DOUBLE_SPEED_TECHS = self.Y_UNIT
		self.W_DOUBLE_SPEED_TECHS = ((self.top.R_PEDIA_PAGE - self.X_UNIT) / 2) - 10
		self.H_DOUBLE_SPEED_TECHS = 110
                
		
###Tweak END###



	def interfaceScreen(self, iCivilization):
		self.iCivilization = iCivilization
		screen = self.top.getScreen()
		
		screen.addPanel(self.top.getNextWidgetName(), "", "", False, False, self.X_MAIN_PANE, self.Y_MAIN_PANE, self.W_MAIN_PANE, self.H_MAIN_PANE, PanelStyles.PANEL_STYLE_BLUE50)
		screen.addPanel(self.top.getNextWidgetName(), "", "", False, False, self.X_ICON, self.Y_ICON, self.W_ICON, self.H_ICON, PanelStyles.PANEL_STYLE_MAIN)
		screen.addDDSGFC(self.top.getNextWidgetName(), ArtFileMgr.getCivilizationArtInfo(gc.getCivilizationInfo(self.iCivilization).getArtDefineTag()).getButton(), self.X_ICON + self.W_ICON/2 - self.ICON_SIZE/2, self.Y_ICON + self.H_ICON/2 - self.ICON_SIZE/2, self.ICON_SIZE, self.ICON_SIZE, WidgetTypes.WIDGET_GENERAL, -1, -1)
		
		self.placeTech()
		self.placeBuilding()
		self.placeUnit()
		self.placeLeader()
		self.placeText()

###Voyhkah Tweak START###
		
		self.placeDoubleSpeedTechs()
		self.placeTraits()

###Tweak END###


	def placeTech(self):
		screen = self.top.getScreen()
		panelName = self.top.getNextWidgetName()
		screen.addPanel(panelName, localText.getText("TXT_KEY_FREE_TECHS", ()), "", False, True, self.X_TECH, self.Y_TECH, self.W_TECH, self.H_TECH, PanelStyles.PANEL_STYLE_BLUE50)
		screen.attachLabel(panelName, "", "  ")
		for iTech in range(gc.getNumTechInfos()):
			if (gc.getCivilizationInfo(self.iCivilization).isCivilizationFreeTechs(iTech)):
				screen.attachImageButton(panelName, "", gc.getTechInfo(iTech).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_TECH, iTech, 1, False)



	def placeBuilding(self):
		screen = self.top.getScreen()
		panelName = self.top.getNextWidgetName()
		screen.addPanel(panelName, localText.getText("TXT_KEY_UNIQUE_BUILDINGS", ()), "", False, True, self.X_BUILDING, self.Y_BUILDING, self.W_BUILDING, self.H_BUILDING, PanelStyles.PANEL_STYLE_BLUE50)
		screen.attachLabel(panelName, "", "  ")
		for iBuilding in range(gc.getNumBuildingClassInfos()):
			iUniqueBuilding = gc.getCivilizationInfo(self.iCivilization).getCivilizationBuildings(iBuilding)
			iDefaultBuilding = gc.getBuildingClassInfo(iBuilding).getDefaultBuildingIndex()
			if (iDefaultBuilding > -1 and iUniqueBuilding > -1 and iDefaultBuilding != iUniqueBuilding):
				screen.attachImageButton(panelName, "", gc.getBuildingInfo(iUniqueBuilding).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BUILDING, iUniqueBuilding, 1, False)



	def placeUnit(self):
		screen = self.top.getScreen()
		panelName = self.top.getNextWidgetName()
		screen.addPanel(panelName, localText.getText("TXT_KEY_FREE_UNITS", ()), "", False, True, self.X_UNIT, self.Y_UNIT, self.W_UNIT, self.H_UNIT, PanelStyles.PANEL_STYLE_BLUE50)
		screen.attachLabel(panelName, "", "  ")
		for iUnit in range(gc.getNumUnitClassInfos()):
			iUniqueUnit = gc.getCivilizationInfo(self.iCivilization).getCivilizationUnits(iUnit)
			iDefaultUnit = gc.getUnitClassInfo(iUnit).getDefaultUnitIndex()
			if (iDefaultUnit > -1 and iUniqueUnit > -1 and iDefaultUnit != iUniqueUnit):
				screen.attachImageButton(panelName, "", gc.getUnitInfo(iUniqueUnit).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT, iUniqueUnit, 1, False)



	def placeLeader(self):
		screen = self.top.getScreen()
		panelName = self.top.getNextWidgetName()
		screen.addPanel(panelName, localText.getText("TXT_KEY_CONCEPT_LEADERS", ()), "", False, True, self.X_LEADER, self.Y_LEADER, self.W_LEADER, self.H_LEADER, PanelStyles.PANEL_STYLE_BLUE50)
		screen.attachLabel(panelName, "", "  ")
		for iLeader in range(gc.getNumLeaderHeadInfos()):
			civ = gc.getCivilizationInfo(self.iCivilization)
			if civ.isLeaders(iLeader):
				screen.attachImageButton(panelName, "", gc.getLeaderHeadInfo(iLeader).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_LEADER, iLeader, self.iCivilization, False)


##Voyhkah Tweak START###

	def placeText(self):
		screen = self.top.getScreen()
		panelName = self.top.getNextWidgetName()
		screen.addPanel(panelName, localText.getText("TXT_KEY_PEDIA_CIVILIZATION_ENTRY", ()), "", True, True, self.X_TEXT, self.Y_TEXT, self.W_TEXT, self.H_TEXT, PanelStyles.PANEL_STYLE_BLUE50)
		szText = gc.getCivilizationInfo(self.iCivilization).getCivilopedia()
		screen.attachMultilineText(panelName, "Text", szText, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)
		
###Tweak END###



	def handleInput (self, inputClass):
		return 0

###Voyhkah Tweak START###

	def placeDoubleSpeedTechs(self):
		screen = self.top.getScreen()
		panelName = self.top.getNextWidgetName()
		screen.addPanel(panelName, localText.getText("TXT_KEY_PEDIA_DOUBLE_SPEED_TECHS", ()), "", False, True, self.X_DOUBLE_SPEED_TECHS, self.Y_DOUBLE_SPEED_TECHS, self.W_DOUBLE_SPEED_TECHS, self.H_DOUBLE_SPEED_TECHS, PanelStyles.PANEL_STYLE_BLUE50)
		screen.attachLabel(panelName, "", "  ")
		for iTech in range(gc.getNumTechInfos()):
			if gc.getCivilizationInfo(self.iCivilization).isDoubleSpeedTech(iTech):
				screen.attachImageButton(panelName, "", gc.getTechInfo(iTech).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_TECH, iTech, 1, False)
		
	def placeTraits(self):
		screen = self.top.getScreen()
		szText = ""
		panelName = self.top.getNextWidgetName()
		screen.addPanel(panelName, localText.getText("TXT_KEY_PEDIA_TRAITS", ()), "", True, True, self.X_TRAITS, self.Y_TEXT, self.W_TEXT, self.H_TEXT, PanelStyles.PANEL_STYLE_BLUE50)
		for iTrait in range(gc.getNumTraitInfos()):
			if gc.getCivilizationInfo(self.iCivilization).isCivilizationTrait(iTrait):
				szText =+ CyGameTextMgr().parseTraits(iTrait, self.iCivilization, False)
		screen.attachMultilineText(panelName, "Text", szText, WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY)

###Tweak END###
 
Whatever the problem is, it's in the DLL.
 
I reverted the DLL but NOT the python and the problem went away.
 
Have you tried reverting the thing one at a time. As in, going through the code and commenting out one function or even one line of code at a time. It's called debugging and it really helps.
 
I feel slightly offended, as I am familiar with debugging, and in fact, am doing it now.
 
I've narrowed it down. Here is the CyInfoInterface.cpp entry for CvCivilizationInfo

Code:
	python::class_<CvCivilizationInfo, python::bases<CvInfoBase> >("CvCivilizationInfo")
		.def("getDefaultPlayerColor", &CvCivilizationInfo::getDefaultPlayerColor, "int ()")
		.def("getArtStyleType", &CvCivilizationInfo::getArtStyleType, "int ()")
		.def("getNumCityNames", &CvCivilizationInfo::getNumCityNames, "int ()")
		.def("getNumLeaders", &CvCivilizationInfo::getNumLeaders, "int ()")

		.def("getSelectionSoundScriptId", &CvCivilizationInfo::getSelectionSoundScriptId)
		.def("getActionSoundScriptId", &CvCivilizationInfo::getActionSoundScriptId)

		.def("isAIPlayable", &CvCivilizationInfo::isAIPlayable, "bool ()")
		.def("isPlayable", &CvCivilizationInfo::isPlayable, "bool ()")

		.def("getShortDescription", &CvCivilizationInfo::pyGetShortDescription, "wstring ()")
		.def("getShortDescriptionKey", &CvCivilizationInfo::pyGetShortDescriptionKey, "wstring ()")
		.def("getAdjective", &CvCivilizationInfo::pyGetAdjective, "wstring ()")
		.def("getFlagTexture", &CvCivilizationInfo::getFlagTexture, "string ()")
		.def("getArtDefineTag", &CvCivilizationInfo::getArtDefineTag, "string ()")
		.def("getButton", &CvCivilizationInfo::getButton, "string ()")

		.def("getDerivativeCiv", &CvCivilizationInfo::getDerivativeCiv, "int ()")

		// Arrays

		.def("getCivilizationBuildings", &CvCivilizationInfo::getCivilizationBuildings, "int (int i)")
		.def("getCivilizationUnits", &CvCivilizationInfo::getCivilizationUnits, "int (int i)")
		.def("getCivilizationFreeUnitsClass", &CvCivilizationInfo::getCivilizationFreeUnitsClass, "int (int i)")
		.def("getCivilizationInitialCivics", &CvCivilizationInfo::getCivilizationInitialCivics, "int (int i)")

		.def("isLeaders", &CvCivilizationInfo::isLeaders, "bool (int i)")
		.def("isCivilizationFreeBuildingClass", &CvCivilizationInfo::isCivilizationFreeBuildingClass, "bool (int i)")
		.def("isCivilizationFreeTechs", &CvCivilizationInfo::isCivilizationFreeTechs, "bool (int i)")
		.def("isCivilizationDisableTechs", &CvCivilizationInfo::isCivilizationDisableTechs, "bool (int i)")

		.def("getCityNames", &CvCivilizationInfo::getCityNames, "string (int i)")

//Voyhkah Tweak START//

		.def("isDoubleSpeedTech", &CvCivilizationInfo::isDoubleSpeedTech, "bool (int iTech)")
		.def("isCivilizationTrait", &CvCivilizationInfo::isHasTrait, "bool (int iTrait)")

//Tweak END//

		;

When that last line is commented out, the error goes away. When it is uncommented, the error is back. Any suggestions?

Oh, and why do I feel like someone is going to say 'Just get rid of that line'. That line exposes the isHasTrait(int iTrait) function to Python, allowing the showing of Civilization Traits in the Pedia screen.
 
I feel slightly offended, as I am familiar with debugging, and in fact, am doing it now.
I am sorry if it came off like that. I did not mean it to sound insulting. I just wanted to make a helpful suggestion. And I am used to a large amount of people NOT knowing what debugging is. Or rather, they know of the practice. They just don't connect it with the name. So more often than not when I tell them to debug I get blank stares (or the appropriate emonicron).
 
Any hints on what's wrong or how to fix it, now that I'm down to one line?
 
Ok, let's try true-or-false. Is the reason that no-one's responding that no-one knows the answer?
 
I have decided to stay away from this thread. Lest I inadvertently insult you again.
 
That's fine, I wasn't too offended. I would be much more offeneded if you left, as not very many people care about me.
 
That's fine, I wasn't too offended. I would be much more offeneded if you left, as not very many people care about me.

I like your work! :thumbsup:
 
I check this tread once or twice a day, it have great potential, but I don't know programming yet so I can't really help you.:hammer2:
 
*sigh*
I don't know why I am bothering. But so help me god if...
*sigh*
I have been analyzing this. And if it's no problem, could you explain in short just what you are attempting to add here and how. As in, are you attempting to add a second panel to the side of another panel? Or under another panel? Etc. Since from the fact that you get no python error (I am assuming the missing ) problem has been fixed and that the old errors were related to that) and your CPP is alright the only thing that I can think off is that you have unintentionally created a panel or text field that covers the whole text.
 
Back
Top Bottom