Linkman226
#anarchy
- Joined
- Sep 14, 2007
- Messages
- 2,493
I added a unit to my mod called the Qizilbash. XML entry:
When I select one, however, I get this python exception:
The offending bit of code is:
Also, from the Python API, I know that the arguments for the method addSpecificUnitGraphicGFC are (STRING szName, CyUnit pUnit, INT iX, INT iY, INT iWidth, INT iHeight, WidgetType eWidgetType, INT iData1, INT iData2, FLOAT fxRotation, FLOAT fzRotation, FLOAT fScale, BOOL bShowBackground). But I'm not sure why this python exception is happening. Any ideas, guys?
Code:
<UnitInfo>
<Class>UNITCLASS_MACEMAN</Class>
<Type>UNIT_QIZILBASH</Type>
<UniqueNames/>
<Special>NONE</Special>
<Capture>NONE</Capture>
<Combat>UNITCOMBAT_MELEE</Combat>
<Domain>DOMAIN_LAND</Domain>
<DefaultUnitAI>UNITAI_COUNTER</DefaultUnitAI>
<Invisible>NONE</Invisible>
<SeeInvisible>NONE</SeeInvisible>
<Description>TXT_KEY_UNIT_QIZILBASH</Description>
<Civilopedia>TXT_KEY_UNIT_QIZILBASH_PEDIA</Civilopedia>
<Strategy>TXT_KEY_UNIT_QIZILBASH_STRATEGY</Strategy>
<Advisor>ADVISOR_MILITARY</Advisor>
<bAnimal>0</bAnimal>
<bFood>0</bFood>
<bNoBadGoodies>0</bNoBadGoodies>
<bOnlyDefensive>0</bOnlyDefensive>
<bNoCapture>0</bNoCapture>
<bQuickCombat>0</bQuickCombat>
<bRivalTerritory>0</bRivalTerritory>
<bMilitaryHappiness>1</bMilitaryHappiness>
<bMilitarySupport>1</bMilitarySupport>
<bMilitaryProduction>1</bMilitaryProduction>
<bPillage>1</bPillage>
<bSpy>0</bSpy>
<bSabotage>0</bSabotage>
<bDestroy>0</bDestroy>
<bStealPlans>0</bStealPlans>
<bInvestigate>0</bInvestigate>
<bCounterSpy>0</bCounterSpy>
<bFound>0</bFound>
<bGoldenAge>0</bGoldenAge>
<bInvisible>0</bInvisible>
<bFirstStrikeImmune>0</bFirstStrikeImmune>
<bNoDefensiveBonus>0</bNoDefensiveBonus>
<bIgnoreBuildingDefense>0</bIgnoreBuildingDefense>
<bCanMoveImpassable>0</bCanMoveImpassable>
<bCanMoveAllTerrain>0</bCanMoveAllTerrain>
<bFlatMovementCost>0</bFlatMovementCost>
<bIgnoreTerrainCost>1</bIgnoreTerrainCost>
<bNukeImmune>0</bNukeImmune>
<bPrereqBonuses>0</bPrereqBonuses>
<bPrereqReligion>0</bPrereqReligion>
<bMechanized>0</bMechanized>
<bSuicide>0</bSuicide>
<bHiddenNationality>0</bHiddenNationality>
<bAlwaysHostile>0</bAlwaysHostile>
<UnitClassUpgrades>
<UnitClassUpgrade>
<UnitClassUpgradeType>UNITCLASS_RIFLEMAN</UnitClassUpgradeType>
<bUnitClassUpgrade>1</bUnitClassUpgrade>
</UnitClassUpgrade>
<UnitClassUpgrade>
<UnitClassUpgradeType>UNITCLASS_GRENADIER</UnitClassUpgradeType>
<bUnitClassUpgrade>1</bUnitClassUpgrade>
</UnitClassUpgrade>
</UnitClassUpgrades>
<UnitClassTargets/>
<UnitCombatTargets/>
<UnitClassDefenders/>
<UnitCombatDefenders/>
<FlankingStrikes/>
<UnitAIs>
<UnitAI>
<UnitAIType>UNITAI_ATTACK</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
<UnitAI>
<UnitAIType>UNITAI_ATTACK_CITY</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
<UnitAI>
<UnitAIType>UNITAI_RESERVE</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
<UnitAI>
<UnitAIType>UNITAI_COUNTER</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
<UnitAI>
<UnitAIType>UNITAI_CITY_COUNTER</UnitAIType>
<bUnitAI>1</bUnitAI>
</UnitAI>
</UnitAIs>
<NotUnitAIs/>
<Builds/>
<ReligionSpreads/>
<CorporationSpreads/>
<GreatPeoples/>
<Buildings/>
<ForceBuildings/>
<HolyCity>NONE</HolyCity>
<ReligionType>NONE</ReligionType>
<StateReligion>NONE</StateReligion>
<PrereqReligion>RELIGION_ISLAM</PrereqReligion>
<PrereqCorporation>NONE</PrereqCorporation>
<PrereqBuilding>NONE</PrereqBuilding>
<PrereqTech>TECH_CIVIL_SERVICE</PrereqTech>
<TechTypes>
<PrereqTech>TECH_MACHINERY</PrereqTech>
<PrereqTech>NONE</PrereqTech>
<PrereqTech>NONE</PrereqTech>
</TechTypes>
<BonusType>NONE</BonusType>
<PrereqBonuses>
<BonusType>BONUS_COPPER</BonusType>
<BonusType>BONUS_IRON</BonusType>
<BonusType>NONE</BonusType>
<BonusType>NONE</BonusType>
</PrereqBonuses>
<ProductionTraits/>
<Flavors/>
<iAIWeight>1</iAIWeight>
<iCost>60</iCost>
<iHurryCostModifier>0</iHurryCostModifier>
<iAdvancedStartCost>100</iAdvancedStartCost>
<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
<iMinAreaSize>-1</iMinAreaSize>
<iMoves>1</iMoves>
<bNoRevealMap>0</bNoRevealMap>
<iAirRange>0</iAirRange>
<iAirUnitCap>0</iAirUnitCap>
<iDropRange>0</iDropRange>
<iNukeRange>-1</iNukeRange>
<iWorkRate>0</iWorkRate>
<iBaseDiscover>0</iBaseDiscover>
<iDiscoverMultiplier>0</iDiscoverMultiplier>
<iBaseHurry>0</iBaseHurry>
<iHurryMultiplier>0</iHurryMultiplier>
<iBaseTrade>0</iBaseTrade>
<iTradeMultiplier>0</iTradeMultiplier>
<iGreatWorkCulture>0</iGreatWorkCulture>
<iEspionagePoints>0</iEspionagePoints>
<TerrainImpassables/>
<!-- Rhye -->
<FeatureImpassables>
<FeatureImpassable>
<FeatureType>FEATURE_JUNGLE</FeatureType>
<bFeatureImpassable>1</bFeatureImpassable>
</FeatureImpassable>
<FeatureImpassable>
<FeatureType>FEATURE_MUD</FeatureType>
<bFeatureImpassable>1</bFeatureImpassable>
</FeatureImpassable>
</FeatureImpassables>
<TerrainPassableTechs/>
<FeaturePassableTechs/>
<iCombat>9</iCombat>
<iCombatLimit>100</iCombatLimit>
<iAirCombat>0</iAirCombat>
<iAirCombatLimit>0</iAirCombatLimit>
<iXPValueAttack>4</iXPValueAttack>
<iXPValueDefense>2</iXPValueDefense>
<iFirstStrikes>0</iFirstStrikes>
<iChanceFirstStrikes>0</iChanceFirstStrikes>
<iInterceptionProbability>0</iInterceptionProbability>
<iEvasionProbability>0</iEvasionProbability>
<iWithdrawalProb>0</iWithdrawalProb>
<iCollateralDamage>0</iCollateralDamage>
<iCollateralDamageLimit>0</iCollateralDamageLimit>
<iCollateralDamageMaxUnits>0</iCollateralDamageMaxUnits>
<iCityAttack>0</iCityAttack>
<iCityDefense>0</iCityDefense>
<iAnimalCombat>0</iAnimalCombat>
<iHillsAttack>0</iHillsAttack>
<iHillsDefense>0</iHillsDefense>
<TerrainNatives/>
<FeatureNatives/>
<TerrainAttacks/>
<TerrainDefenses/>
<FeatureAttacks/>
<FeatureDefenses/>
<UnitClassAttackMods/>
<UnitClassDefenseMods/>
<UnitCombatMods>
<UnitCombatMod>
<UnitCombatType>UNITCOMBAT_MELEE</UnitCombatType>
<iUnitCombatMod>50</iUnitCombatMod>
</UnitCombatMod>
</UnitCombatMods>
<UnitCombatCollateralImmunes/>
<DomainMods/>
<BonusProductionModifiers/>
<iBombRate>0</iBombRate>
<iBombardRate>0</iBombardRate>
<SpecialCargo>NONE</SpecialCargo>
<DomainCargo>NONE</DomainCargo>
<iCargo>0</iCargo>
<iConscription>3</iConscription>
<iCultureGarrison>6</iCultureGarrison>
<iExtraCost>0</iExtraCost>
<iAsset>3</iAsset>
<iPower>10</iPower>
<UnitMeshGroups>
<iGroupSize>3</iGroupSize>
<fMaxSpeed>1.75</fMaxSpeed>
<fPadTime>1</fPadTime>
<iMeleeWaveSize>3</iMeleeWaveSize>
<iRangedWaveSize>0</iRangedWaveSize>
<UnitMeshGroup>
<iRequired>3</iRequired>
<EarlyArtDefineTag>ART_DEF_UNIT_QIZILBASH</EarlyArtDefineTag>
</UnitMeshGroup>
</UnitMeshGroups>
<FormationType>FORMATION_TYPE_DEFAULT</FormationType>
<HotKey/>
<bAltDown>0</bAltDown>
<bShiftDown>0</bShiftDown>
<bCtrlDown>0</bCtrlDown>
<iHotKeyPriority>0</iHotKeyPriority>
<FreePromotions>
<FreePromotion>
<PromotionType>PROMOTION_CITY_RAIDER1</PromotionType>
<bFreePromotion>1</bFreePromotion>
</FreePromotion>
</FreePromotions>
<LeaderPromotion>NONE</LeaderPromotion>
<iLeaderExperience>0</iLeaderExperience>
</UnitInfo>
When I select one, however, I get this python exception:
Code:
Traceback (most recent call last):
File "CvScreensInterface", line 736, in forceScreenRedraw
File "CvMainInterface", line 785, in redraw
File "CvMainInterface", line 1202, in updatePlotListButtons
RuntimeError: unidentifiable C++ exception
ERR: Python function forceScreenRedraw failed, module CvScreensInterface
The offending bit of code is:
Code:
def updatePlotListButtons( self ):
screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
xResolution = screen.getXResolution()
yResolution = screen.getYResolution()
bHandled = False
if ( CyInterface().shouldDisplayUnitModel() and CyEngine().isGlobeviewUp() == false and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL ):
if ( CyInterface().isCitySelection() ):
iOrders = CyInterface().getNumOrdersQueued()
for i in range( iOrders ):
if ( bHandled == False ):
eOrderNodeType = CyInterface().getOrderNodeType(i)
if (eOrderNodeType == OrderTypes.ORDER_TRAIN ):
screen.addUnitGraphicGFC( "InterfaceUnitModel", CyInterface().getOrderNodeData1(i), 175, yResolution - 138, 123, 132, WidgetTypes.WIDGET_HELP_SELECTED, 0, -1, -20, 30, 1, False )
bHandled = True
elif ( eOrderNodeType == OrderTypes.ORDER_CONSTRUCT ):
screen.addBuildingGraphicGFC( "InterfaceUnitModel", CyInterface().getOrderNodeData1(i), 175, yResolution - 138, 123, 132, WidgetTypes.WIDGET_HELP_SELECTED, 0, -1, -20, 30, 0.8, False )
bHandled = True
elif ( eOrderNodeType == OrderTypes.ORDER_CREATE ):
if(gc.getProjectInfo(CyInterface().getOrderNodeData1(i)).isSpaceship()):
modelType = 0
screen.addSpaceShipWidgetGFC("InterfaceUnitModel", 175, yResolution - 138, 123, 132, CyInterface().getOrderNodeData1(i), modelType, WidgetTypes.WIDGET_HELP_SELECTED, 0, -1)
else:
screen.hide( "InterfaceUnitModel" )
bHandled = True
elif ( eOrderNodeType == OrderTypes.ORDER_MAINTAIN ):
screen.hide( "InterfaceUnitModel" )
bHandled = True
if ( not bHandled ):
screen.hide( "InterfaceUnitModel" )
bHandled = True
screen.moveToFront("SelectedCityText")
elif ( CyInterface().getHeadSelectedUnit() ):
[COLOR="Red"]screen.addSpecificUnitGraphicGFC( "InterfaceUnitModel", CyInterface().getHeadSelectedUnit(), 175, yResolution - 138, 123, 132, WidgetTypes.WIDGET_UNIT_MODEL, CyInterface().getHeadSelectedUnit().getUnitType(), -1, -20, 30, 1, False )[/COLOR]
screen.moveToFront("SelectedUnitText")
else:
screen.hide( "InterfaceUnitModel" )
else:
screen.hide( "InterfaceUnitModel" )
pPlot = CyInterface().getSelectionPlot()
for i in range(gc.getNumPromotionInfos()):
szName = "PromotionButton" + str(i)
screen.moveToFront( szName )
screen.hide( "PlotListMinus" )
screen.hide( "PlotListPlus" )
for j in range(gc.getMAX_PLOT_LIST_ROWS()):
#szStringPanel = "PlotListPanel" + str(j)
#screen.hide(szStringPanel)
for i in range(self.numPlotListButtons()):
szString = "PlotListButton" + str(j*self.numPlotListButtons()+i)
screen.hide( szString )
szStringHealth = szString + "Health"
screen.hide( szStringHealth )
szStringIcon = szString + "Icon"
screen.hide( szStringIcon )
if ( pPlot and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL and CyEngine().isGlobeviewUp() == False):
iVisibleUnits = CyInterface().getNumVisibleUnits()
iCount = -(CyInterface().getPlotListColumn())
bLeftArrow = False
bRightArrow = False
if (CyInterface().isCityScreenUp()):
iMaxRows = 1
iSkipped = (gc.getMAX_PLOT_LIST_ROWS() - 1) * self.numPlotListButtons()
iCount += iSkipped
else:
iMaxRows = gc.getMAX_PLOT_LIST_ROWS()
iCount += CyInterface().getPlotListOffset()
iSkipped = 0
CyInterface().cacheInterfacePlotUnits(pPlot)
for i in range(CyInterface().getNumCachedInterfacePlotUnits()):
pLoopUnit = CyInterface().getCachedInterfacePlotUnit(i)
if (pLoopUnit):
if ((iCount == 0) and (CyInterface().getPlotListColumn() > 0)):
bLeftArrow = True
elif ((iCount == (gc.getMAX_PLOT_LIST_ROWS() * self.numPlotListButtons() - 1)) and ((iVisibleUnits - iCount - CyInterface().getPlotListColumn() + iSkipped) > 1)):
bRightArrow = True
if ((iCount >= 0) and (iCount < self.numPlotListButtons() * gc.getMAX_PLOT_LIST_ROWS())):
if ((pLoopUnit.getTeam() != gc.getGame().getActiveTeam()) or pLoopUnit.isWaiting()):
szFileName = ArtFileMgr.getInterfaceArtInfo("OVERLAY_FORTIFY").getPath()
elif (pLoopUnit.canMove()):
if (pLoopUnit.hasMoved()):
szFileName = ArtFileMgr.getInterfaceArtInfo("OVERLAY_HASMOVED").getPath()
else:
szFileName = ArtFileMgr.getInterfaceArtInfo("OVERLAY_MOVE").getPath()
else:
szFileName = ArtFileMgr.getInterfaceArtInfo("OVERLAY_NOMOVE").getPath()
szString = "PlotListButton" + str(iCount)
screen.changeImageButton( szString, pLoopUnit.getButton() )
if ( pLoopUnit.getOwner() == gc.getGame().getActivePlayer() ):
bEnable = True
else:
bEnable = False
screen.enable(szString, bEnable)
if (pLoopUnit.IsSelected()):
screen.setState(szString, True)
else:
screen.setState(szString, False)
screen.show( szString )
# place the health bar
if (pLoopUnit.isFighting()):
bShowHealth = False
elif (pLoopUnit.getDomainType() == DomainTypes.DOMAIN_AIR):
bShowHealth = pLoopUnit.canAirAttack()
else:
bShowHealth = pLoopUnit.canFight()
if bShowHealth:
szStringHealth = szString + "Health"
screen.setBarPercentage( szStringHealth, InfoBarTypes.INFOBAR_STORED, float( pLoopUnit.currHitPoints() ) / float( pLoopUnit.maxHitPoints() ) )
if (pLoopUnit.getDamage() >= ((pLoopUnit.maxHitPoints() * 2) / 3)):
screen.setStackedBarColors(szStringHealth, InfoBarTypes.INFOBAR_STORED, gc.getInfoTypeForString("COLOR_RED"))
elif (pLoopUnit.getDamage() >= (pLoopUnit.maxHitPoints() / 3)):
screen.setStackedBarColors(szStringHealth, InfoBarTypes.INFOBAR_STORED, gc.getInfoTypeForString("COLOR_YELLOW"))
else:
screen.setStackedBarColors(szStringHealth, InfoBarTypes.INFOBAR_STORED, gc.getInfoTypeForString("COLOR_GREEN"))
screen.show( szStringHealth )
# Adds the overlay first
szStringIcon = szString + "Icon"
screen.changeDDSGFC( szStringIcon, szFileName )
screen.show( szStringIcon )
iCount = iCount + 1
if (iVisibleUnits > self.numPlotListButtons() * iMaxRows):
screen.enable("PlotListMinus", bLeftArrow)
screen.show( "PlotListMinus" )
screen.enable("PlotListPlus", bRightArrow)
screen.show( "PlotListPlus" )
return 0
Also, from the Python API, I know that the arguments for the method addSpecificUnitGraphicGFC are (STRING szName, CyUnit pUnit, INT iX, INT iY, INT iWidth, INT iHeight, WidgetType eWidgetType, INT iData1, INT iData2, FLOAT fxRotation, FLOAT fzRotation, FLOAT fScale, BOOL bShowBackground). But I'm not sure why this python exception is happening. Any ideas, guys?