home *** CD-ROM | disk | FTP | other *** search
/ GameStar 2006 January / Gamestar_80_2006-01_dvd.iso / Dema / Civilization4 / data1.cab / Civ4DemoComponent / Assets / Python / Screens / CvMainInterface.py < prev    next >
Encoding:
Python Source  |  2005-11-09  |  127.9 KB  |  2,855 lines

  1. ## Sid Meier's Civilization 4
  2. ## Copyright Firaxis Games 2005
  3. from CvPythonExtensions import *
  4. import CvUtil
  5. import ScreenInput
  6. import CvScreenEnums
  7. import CvEventInterface
  8. import time
  9.  
  10. # globals
  11. gc = CyGlobalContext()
  12. ArtFileMgr = CyArtFileMgr()
  13. localText = CyTranslator()
  14.  
  15. g_NumEmphasizeInfos = 0
  16. g_NumCityTabTypes = 0
  17. g_NumHurryInfos = 0
  18. g_NumUnitClassInfos = 0
  19. g_NumBuildingClassInfos = 0
  20. g_NumProjectInfos = 0
  21. g_NumProcessInfos = 0
  22. g_NumActionInfos = 0
  23. g_eEndTurnButtonState = -1
  24.  
  25. MAX_SELECTED_TEXT = 5
  26. MAX_DISPLAYABLE_BUILDINGS = 15
  27. MAX_DISPLAYABLE_TRADE_ROUTES = 4
  28. MAX_BONUS_ROWS = 10
  29. MAX_CITIZEN_BUTTONS = 6
  30.  
  31. SELECTION_BUTTON_COLUMNS = 8
  32. SELECTION_BUTTON_ROWS = 2
  33. NUM_SELECTION_BUTTONS = SELECTION_BUTTON_ROWS * SELECTION_BUTTON_COLUMNS
  34.  
  35. g_iNumBuildingWidgets = MAX_DISPLAYABLE_BUILDINGS
  36. g_iNumTradeRouteWidgets = MAX_DISPLAYABLE_TRADE_ROUTES
  37.  
  38. # END OF TURN BUTTON POSITIONS
  39. ######################
  40. iEndOfTurnButtonSize = 32
  41. iEndOfTurnPosX = 296 # distance from right
  42. iEndOfTurnPosY = 147 # distance from bottom
  43.  
  44. # MINIMAP BUTTON POSITIONS
  45. ######################
  46. iMinimapButtonsExtent = 228
  47. iMinimapButtonsX = 227
  48. iMinimapButtonsY_Regular = 160
  49. iMinimapButtonsY_Minimal = 32
  50. iMinimapButtonWidth = 24
  51. iMinimapButtonHeight = 24
  52.  
  53. # Globe button
  54. iGlobeButtonX = 48
  55. iGlobeButtonY_Regular = 168
  56. iGlobeButtonY_Minimal = 40
  57. iGlobeToggleWidth = 48
  58. iGlobeToggleHeight = 48
  59.  
  60. # GLOBE LAYER OPTION POSITIONING
  61. ######################
  62. iGlobeLayerOptionsX  = 235
  63. iGlobeLayerOptionsY_Regular  = 170# distance from bottom edge
  64. iGlobeLayerOptionsY_Minimal  = 38 # distance from bottom edge
  65. iGlobeLayerOptionsWidth = 400
  66. iGlobeLayerOptionHeight = 24
  67.  
  68. # STACK BAR
  69. #####################
  70. iStackBarHeight = 27
  71.  
  72.  
  73. # MULTI LIST
  74. #####################
  75. iMultiListXL = 318
  76. iMultiListXR = 332
  77.  
  78.  
  79. # TOP CENTER TITLE
  80. #####################
  81. iCityCenterRow1X = 398
  82. iCityCenterRow1Y = 78
  83. iCityCenterRow2X = 398
  84. iCityCenterRow2Y = 104
  85.  
  86. iCityCenterRow1Xa = 347
  87. iCityCenterRow2Xa = 482
  88.  
  89.  
  90. g_iNumTradeRoutes = 0
  91. g_iNumBuildings = 0
  92. g_iNumLeftBonus = 0
  93. g_iNumCenterBonus = 0
  94. g_iNumRightBonus = 0
  95.  
  96. g_szTimeText = ""
  97. g_iTimeTextCounter = 0
  98.  
  99. g_pSelectedUnit = 0
  100.  
  101. class CvMainInterface:
  102.     "Main Interface Screen"
  103.  
  104.     def interfaceScreen (self):
  105.  
  106.         # Global variables being set here
  107.         global g_NumEmphasizeInfos
  108.         global g_NumCityTabTypes
  109.         global g_NumHurryInfos
  110.         global g_NumUnitClassInfos
  111.         global g_NumBuildingClassInfos
  112.         global g_NumProjectInfos
  113.         global g_NumProcessInfos
  114.         global g_NumActionInfos
  115.         
  116.         global MAX_SELECTED_TEXT
  117.         global MAX_DISPLAYABLE_BUILDINGS
  118.         global MAX_DISPLAYABLE_TRADE_ROUTES
  119.         global MAX_BONUS_ROWS
  120.         global MAX_CITIZEN_BUTTONS
  121.         
  122.         if ( CyGame().isPitbossHost() ):
  123.             return
  124.  
  125.         # This is the main interface screen, create it as such
  126.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  127.         screen.setForcedRedraw(True)
  128.  
  129.         # Find out our resolution
  130.         xResolution = screen.getXResolution()
  131.         yResolution = screen.getYResolution()
  132.         
  133.         screen.setDimensions(0, 0, xResolution, yResolution)
  134.  
  135.         # Set up our global variables...
  136.         g_NumEmphasizeInfos = gc.getNumEmphasizeInfos()
  137.         g_NumCityTabTypes = CityTabTypes.NUM_CITYTAB_TYPES
  138.         g_NumHurryInfos = gc.getNumHurryInfos()
  139.         g_NumUnitClassInfos = gc.getNumUnitClassInfos()
  140.         g_NumBuildingClassInfos = gc.getNumBuildingClassInfos()
  141.         g_NumProjectInfos = gc.getNumProjectInfos()
  142.         g_NumProcessInfos = gc.getNumProcessInfos()
  143.         g_NumActionInfos = gc.getNumActionInfos()
  144.         
  145.         # Help Text Area
  146.         screen.setHelpTextArea( 350, FontTypes.SMALL_FONT, 7, yResolution - 172, -0.1, False, "", True, False, CvUtil.FONT_LEFT_JUSTIFY, 150 )
  147.  
  148.         # Center Left
  149.         screen.addPanel( "InterfaceCenterLeftBackgroundWidget", u"", u"", True, False, 0, 0, 258, yResolution-149, PanelStyles.PANEL_STYLE_STANDARD )
  150.         screen.setStyle( "InterfaceCenterLeftBackgroundWidget", "Panel_City_Left_Style" )
  151.         screen.hide( "InterfaceCenterLeftBackgroundWidget" )
  152.  
  153.         # Top Left
  154.         screen.addPanel( "InterfaceTopLeftBackgroundWidget", u"", u"", True, False, 258, 0, xResolution - 516, yResolution-149, PanelStyles.PANEL_STYLE_STANDARD )
  155.         screen.setStyle( "InterfaceTopLeftBackgroundWidget", "Panel_City_Top_Style" )
  156.         screen.hide( "InterfaceTopLeftBackgroundWidget" )
  157.  
  158.         # Center Right
  159.         screen.addPanel( "InterfaceCenterRightBackgroundWidget", u"", u"", True, False, xResolution - 258, 0, 258, yResolution-149, PanelStyles.PANEL_STYLE_STANDARD )
  160.         screen.setStyle( "InterfaceCenterRightBackgroundWidget", "Panel_City_Right_Style" )
  161.         screen.hide( "InterfaceCenterRightBackgroundWidget" )
  162.         
  163.         screen.addPanel( "CityScreenAdjustPanel", u"", u"", True, False, 10, 44, 238, 86, PanelStyles.PANEL_STYLE_STANDARD )
  164.         screen.setStyle( "CityScreenAdjustPanel", "Panel_City_Info_Style" )
  165.         screen.hide( "CityScreenAdjustPanel" )
  166.         
  167.         screen.addPanel( "TopCityPanelLeft", u"", u"", True, False, 260, 70, xResolution/2-260, 60, PanelStyles.PANEL_STYLE_STANDARD )
  168.         screen.setStyle( "TopCityPanelLeft", "Panel_City_TanTL_Style" )
  169.         screen.hide( "TopCityPanelLeft" )
  170.         
  171.         screen.addPanel( "TopCityPanelRight", u"", u"", True, False, xResolution/2, 70, xResolution/2-260, 60, PanelStyles.PANEL_STYLE_STANDARD )
  172.         screen.setStyle( "TopCityPanelRight", "Panel_City_TanTR_Style" )
  173.         screen.hide( "TopCityPanelRight" )
  174.         
  175.         # Top Bar
  176.  
  177.         # SF CHANGE        
  178.         screen.addPanel( "CityScreenTopWidget", u"", u"", True, False, 0, -2, xResolution, 41, PanelStyles.PANEL_STYLE_STANDARD )
  179.  
  180.         screen.setStyle( "CityScreenTopWidget", "Panel_TopBar_Style" )
  181.         screen.hide( "CityScreenTopWidget" )
  182.         
  183.         # Top Center Title
  184.         screen.addPanel( "CityNameBackground", u"", u"", True, False, 260, 31, xResolution - (260*2), 38, PanelStyles.PANEL_STYLE_STANDARD )
  185.         screen.setStyle( "CityNameBackground", "Panel_City_Title_Style" )
  186.         screen.hide( "CityNameBackground" )
  187.  
  188.         # Left Background Widget
  189.         screen.addDDSGFC( "InterfaceLeftBackgroundWidget", ArtFileMgr.getInterfaceArtInfo("INTERFACE_BOTTOM_LEFT").getPath(), 0, yResolution - 164, 304, 164, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  190.         screen.hide( "InterfaceLeftBackgroundWidget" )
  191.  
  192.         # Center Background Widget
  193.         screen.addPanel( "InterfaceCenterBackgroundWidget", u"", u"", True, False, 296, yResolution - 133, xResolution - (296*2), 133, PanelStyles.PANEL_STYLE_STANDARD)
  194.         screen.setStyle( "InterfaceCenterBackgroundWidget", "Panel_Game_HudBC_Style" )
  195.         screen.hide( "InterfaceCenterBackgroundWidget" )
  196.  
  197.         # Left Background Widget
  198.         screen.addPanel( "InterfaceLeftBackgroundWidget", u"", u"", True, False, 0, yResolution - 168, 304, 168, PanelStyles.PANEL_STYLE_STANDARD)
  199.         screen.setStyle( "InterfaceLeftBackgroundWidget", "Panel_Game_HudBL_Style" )
  200.         screen.hide( "InterfaceLeftBackgroundWidget" )
  201.  
  202.         # Right Background Widget
  203.         screen.addPanel( "InterfaceRightBackgroundWidget", u"", u"", True, False, xResolution - 304, yResolution - 168, 304, 168, PanelStyles.PANEL_STYLE_STANDARD)
  204.         screen.setStyle( "InterfaceRightBackgroundWidget", "Panel_Game_HudBR_Style" )
  205.         screen.hide( "InterfaceRightBackgroundWidget" )
  206.     
  207.         # Top Center Background
  208.  
  209.         # SF CHANGE
  210.         screen.addPanel( "InterfaceTopCenter", u"", u"", True, False, 257, -2, xResolution-(257*2), 48, PanelStyles.PANEL_STYLE_STANDARD)
  211.  
  212.         screen.setStyle( "InterfaceTopCenter", "Panel_Game_HudTC_Style" )
  213.         screen.hide( "InterfaceTopCenter" )
  214.  
  215.         # Top Left Background
  216.         screen.addPanel( "InterfaceTopLeft", u"", u"", True, False, 0, -2, 267, 60, PanelStyles.PANEL_STYLE_STANDARD)
  217.         screen.setStyle( "InterfaceTopLeft", "Panel_Game_HudTL_Style" )
  218.         screen.hide( "InterfaceTopLeft" )
  219.  
  220.         # Top Right Background
  221.         screen.addPanel( "InterfaceTopRight", u"", u"", True, False, xResolution - 267, -2, 267, 60, PanelStyles.PANEL_STYLE_STANDARD)
  222.         screen.setStyle( "InterfaceTopRight", "Panel_Game_HudTR_Style" )
  223.         screen.hide( "InterfaceTopRight" )
  224.  
  225.         iBtnWidth    = 28
  226.         iBtnAdvance = 26
  227.         iBtnY = 27
  228.         iBtnX = 27
  229.         
  230.         # Turn log Button
  231.         screen.setImageButton( "TurnLogButton", "", iBtnX, iBtnY - 1, iBtnWidth, iBtnWidth, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_TURN_LOG).getActionInfoIndex(), -1 )
  232.         screen.setStyle( "TurnLogButton", "Button_HUDLog_Style" )
  233.         screen.hide( "TurnLogButton" )
  234.         
  235.         iBtnX = xResolution - 241
  236.         
  237.         # Advisor Buttons...
  238.         screen.setImageButton( "DomesticAdvisorButton", "", iBtnX, iBtnY, iBtnWidth, iBtnWidth, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_DOMESTIC_SCREEN).getActionInfoIndex(), -1 )
  239.         screen.setStyle( "DomesticAdvisorButton", "Button_HUDAdvisorDomestic_Style" )
  240.         screen.hide( "DomesticAdvisorButton" )
  241.  
  242.         iBtnX += iBtnAdvance
  243.         screen.setImageButton( "FinanceAdvisorButton", "", iBtnX, iBtnY, iBtnWidth, iBtnWidth, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_FINANCIAL_SCREEN).getActionInfoIndex(), -1 )
  244.         screen.setStyle( "FinanceAdvisorButton", "Button_HUDAdvisorFinance_Style" )
  245.         screen.hide( "FinanceAdvisorButton" )
  246.         
  247.         iBtnX += iBtnAdvance
  248.         screen.setImageButton( "CivicsAdvisorButton", "", iBtnX, iBtnY, iBtnWidth, iBtnWidth, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_CIVICS_SCREEN).getActionInfoIndex(), -1 )
  249.         screen.setStyle( "CivicsAdvisorButton", "Button_HUDAdvisorCivics_Style" )
  250.         screen.hide( "CivicsAdvisorButton" )
  251.         
  252.         iBtnX += iBtnAdvance 
  253.         screen.setImageButton( "ForeignAdvisorButton", "", iBtnX, iBtnY, iBtnWidth, iBtnWidth, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_FOREIGN_SCREEN).getActionInfoIndex(), -1 )
  254.         screen.setStyle( "ForeignAdvisorButton", "Button_HUDAdvisorForeign_Style" )
  255.         screen.hide( "ForeignAdvisorButton" )
  256.         
  257.         iBtnX += iBtnAdvance
  258.         screen.setImageButton( "MilitaryAdvisorButton", "", iBtnX, iBtnY, iBtnWidth, iBtnWidth, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_MILITARY_SCREEN).getActionInfoIndex(), -1 )
  259.         screen.setStyle( "MilitaryAdvisorButton", "Button_HUDAdvisorMilitary_Style" )
  260.         screen.hide( "MilitaryAdvisorButton" )
  261.         
  262.         iBtnX += iBtnAdvance
  263.         screen.setImageButton( "TechAdvisorButton", "", iBtnX, iBtnY, iBtnWidth, iBtnWidth, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_TECH_CHOOSER).getActionInfoIndex(), -1 )
  264.         screen.setStyle( "TechAdvisorButton", "Button_HUDAdvisorTechnology_Style" )
  265.         screen.hide( "TechAdvisorButton" )
  266.  
  267.         iBtnX += iBtnAdvance
  268.         screen.setImageButton( "ReligiousAdvisorButton", "", iBtnX, iBtnY, iBtnWidth, iBtnWidth, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_RELIGION_SCREEN).getActionInfoIndex(), -1 )
  269.         screen.setStyle( "ReligiousAdvisorButton", "Button_HUDAdvisorReligious_Style" )
  270.         screen.hide( "ReligiousAdvisorButton" )
  271.         
  272.         iBtnX += iBtnAdvance
  273.         screen.setImageButton( "VictoryAdvisorButton", "", iBtnX, iBtnY, iBtnWidth, iBtnWidth, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_VICTORY_SCREEN).getActionInfoIndex(), -1 )
  274.         screen.setStyle( "VictoryAdvisorButton", "Button_HUDAdvisorVictory_Style" )
  275.         screen.hide( "VictoryAdvisorButton" )
  276.         
  277.         iBtnX += iBtnAdvance
  278.         screen.setImageButton( "InfoAdvisorButton", "", iBtnX, iBtnY, iBtnWidth, iBtnWidth, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_INFO).getActionInfoIndex(), -1 )
  279.         screen.setStyle( "InfoAdvisorButton", "Button_HUDAdvisorRecord_Style" )
  280.         screen.hide( "InfoAdvisorButton" )
  281.  
  282.         
  283.         # City Tabs
  284.         iBtnX = xResolution - 324
  285.         iBtnY = yResolution - 94
  286.         iBtnWidth = 24
  287.         iBtnAdvance = 24
  288.  
  289.         screen.setButtonGFC( "CityTab0", "", "", iBtnX, iBtnY, iBtnWidth, iBtnWidth, WidgetTypes.WIDGET_CITY_TAB, 0, -1, ButtonStyles.BUTTON_STYLE_STANDARD )
  290.         screen.setStyle( "CityTab0", "Button_HUDJumpUnit_Style" )
  291.         screen.hide( "CityTab0" )
  292.  
  293.         iBtnY += iBtnAdvance
  294.         screen.setButtonGFC( "CityTab1", "", "", iBtnX, iBtnY, iBtnWidth, iBtnWidth, WidgetTypes.WIDGET_CITY_TAB, 1, -1, ButtonStyles.BUTTON_STYLE_STANDARD )
  295.         screen.setStyle( "CityTab1", "Button_HUDJumpBuilding_Style" )
  296.         screen.hide( "CityTab1" )
  297.         
  298.         iBtnY += iBtnAdvance
  299.         screen.setButtonGFC( "CityTab2", "", "", iBtnX, iBtnY, iBtnWidth, iBtnWidth, WidgetTypes.WIDGET_CITY_TAB, 2, -1, ButtonStyles.BUTTON_STYLE_STANDARD )
  300.         screen.setStyle( "CityTab2", "Button_HUDJumpWonder_Style" )
  301.         screen.hide( "CityTab2" )
  302.         
  303.         # Minimap initialization
  304.         screen.setMainInterface(True)
  305.         
  306.         screen.addPanel( "MiniMapPanel", u"", u"", True, False, xResolution - 214, yResolution - 151, 208, 151, PanelStyles.PANEL_STYLE_STANDARD )
  307.         screen.setStyle( "MiniMapPanel", "Panel_Game_HudMap_Style" )
  308.         screen.hide( "MiniMapPanel" )
  309.  
  310.         screen.initMinimap( xResolution - 210, xResolution - 9, yResolution - 131, yResolution - 9, -0.1 )
  311.         gc.getMap().updateMinimapColor()
  312.  
  313.         self.createMinimapButtons()
  314.     
  315.         iBtnSX = xResolution - 284
  316.         
  317.         iBtnX = iBtnSX
  318.         iBtnY = yResolution - 140
  319.         iBtnW = 64
  320.         iBtnH = 30
  321.  
  322.         # Conscript button
  323.         szText = "<font=1>" + localText.getText("TXT_KEY_DRAFT", ()) + "</font>"
  324.         screen.setButtonGFC( "Conscript", szText, "", iBtnX, iBtnY, iBtnW, iBtnH, WidgetTypes.WIDGET_CONSCRIPT, -1, -1, ButtonStyles.BUTTON_STYLE_STANDARD )
  325.         screen.setStyle( "Conscript", "Button_CityT1_Style" )
  326.         screen.hide( "Conscript" )
  327.  
  328.         iBtnY += iBtnH
  329.         iBtnW = 32
  330.         iBtnH = 28
  331.         
  332.         # Hurry Buttons        
  333.         screen.setButtonGFC( "Hurry0", "", "", iBtnX, iBtnY, iBtnW, iBtnH, WidgetTypes.WIDGET_HURRY, 0, -1, ButtonStyles.BUTTON_STYLE_STANDARD )
  334.         screen.setStyle( "Hurry0", "Button_CityC1_Style" )
  335.         screen.hide( "Hurry0" )
  336.  
  337.         iBtnX += iBtnW
  338.  
  339.         screen.setButtonGFC( "Hurry1", "", "", iBtnX, iBtnY, iBtnW, iBtnH, WidgetTypes.WIDGET_HURRY, 1, -1, ButtonStyles.BUTTON_STYLE_STANDARD )
  340.         screen.setStyle( "Hurry1", "Button_CityC2_Style" )
  341.         screen.hide( "Hurry1" )
  342.     
  343.         iBtnX = iBtnSX
  344.         iBtnY += iBtnH
  345.     
  346.         # Automate Production Button
  347.         #screen.addCheckBoxGFC( "AutomateProduction", ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTONS_GOVERNOR_PRODUCTION").getPath(), ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(), xResolution - 284, yResolution - 80, 30, 30, WidgetTypes.WIDGET_AUTOMATE_PRODUCTION, -1, -1, ButtonStyles.BUTTON_STYLE_CITY_B02BL )
  348.         screen.addCheckBoxGFC( "AutomateProduction", "", "", iBtnX, iBtnY, iBtnW, iBtnH, WidgetTypes.WIDGET_AUTOMATE_PRODUCTION, -1, -1, ButtonStyles.BUTTON_STYLE_STANDARD )
  349.         screen.setStyle( "AutomateProduction", "Button_CityC3_Style" )
  350.         screen.hide( "AutomateProduction" )
  351.  
  352.         iBtnX += iBtnW
  353.  
  354.         # Automate Citizens Button
  355.         #screen.addCheckBoxGFC( "AutomateCitizens", ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTONS_GOVERNOR").getPath(), ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(), xResolution - 254, yResolution - 80, 30, 30, WidgetTypes.WIDGET_AUTOMATE_CITIZENS, -1, -1, ButtonStyles.BUTTON_STYLE_CITY_B02BR )
  356.         screen.addCheckBoxGFC( "AutomateCitizens", "", "", iBtnX, iBtnY, iBtnW, iBtnH, WidgetTypes.WIDGET_AUTOMATE_CITIZENS, -1, -1, ButtonStyles.BUTTON_STYLE_STANDARD )
  357.         screen.setStyle( "AutomateCitizens", "Button_CityC4_Style" )
  358.         screen.hide( "AutomateCitizens" )
  359.  
  360.         iBtnY += iBtnH
  361.         iBtnX = iBtnSX
  362.  
  363.         iBtnW    = 22
  364.         iBtnWa    = 20
  365.         iBtnH    = 24
  366.         iBtnHa    = 27
  367.     
  368.         # Set Emphasize buttons
  369.         i = 0
  370.         szButtonID = "Emphasize" + str(i)
  371.         screen.addCheckBoxGFC( szButtonID, "", "", iBtnX, iBtnY, iBtnW, iBtnH, WidgetTypes.WIDGET_EMPHASIZE, i, -1, ButtonStyles.BUTTON_STYLE_LABEL )
  372.         szStyle = "Button_CityB" + str(i+1) + "_Style"
  373.         screen.setStyle( szButtonID, szStyle )
  374.         screen.hide( szButtonID )
  375.  
  376.         i+=1
  377.         szButtonID = "Emphasize" + str(i)
  378.         screen.addCheckBoxGFC( szButtonID, "", "", iBtnX+iBtnW, iBtnY, iBtnWa, iBtnH, WidgetTypes.WIDGET_EMPHASIZE, i, -1, ButtonStyles.BUTTON_STYLE_LABEL )
  379.         szStyle = "Button_CityB" + str(i+1) + "_Style"
  380.         screen.setStyle( szButtonID, szStyle )
  381.         screen.hide( szButtonID )
  382.  
  383.         i+=1
  384.         szButtonID = "Emphasize" + str(i)
  385.         screen.addCheckBoxGFC( szButtonID, "", "", iBtnX+iBtnW+iBtnWa, iBtnY, iBtnW, iBtnH, WidgetTypes.WIDGET_EMPHASIZE, i, -1, ButtonStyles.BUTTON_STYLE_LABEL )
  386.         szStyle = "Button_CityB" + str(i+1) + "_Style"
  387.         screen.setStyle( szButtonID, szStyle )
  388.         screen.hide( szButtonID )
  389.  
  390.         iBtnY += iBtnH
  391.         
  392.         i+=1
  393.         szButtonID = "Emphasize" + str(i)
  394.         screen.addCheckBoxGFC( szButtonID, "", "", iBtnX, iBtnY, iBtnW, iBtnHa, WidgetTypes.WIDGET_EMPHASIZE, i, -1, ButtonStyles.BUTTON_STYLE_LABEL )
  395.         szStyle = "Button_CityB" + str(i+1) + "_Style"
  396.         screen.setStyle( szButtonID, szStyle )
  397.         screen.hide( szButtonID )
  398.  
  399.         i+=1
  400.         szButtonID = "Emphasize" + str(i)
  401.         screen.addCheckBoxGFC( szButtonID, "", "", iBtnX+iBtnW, iBtnY, iBtnWa, iBtnHa, WidgetTypes.WIDGET_EMPHASIZE, i, -1, ButtonStyles.BUTTON_STYLE_LABEL )
  402.         szStyle = "Button_CityB" + str(i+1) + "_Style"
  403.         screen.setStyle( szButtonID, szStyle )
  404.         screen.hide( szButtonID )
  405.  
  406.         i+=1
  407.         szButtonID = "Emphasize" + str(i)
  408.         screen.addCheckBoxGFC( szButtonID, "", "", iBtnX+iBtnW+iBtnWa, iBtnY, iBtnW, iBtnHa, WidgetTypes.WIDGET_EMPHASIZE, i, -1, ButtonStyles.BUTTON_STYLE_LABEL )
  409.         szStyle = "Button_CityB" + str(i+1) + "_Style"
  410.         screen.setStyle( szButtonID, szStyle )
  411.         screen.hide( szButtonID )
  412.         
  413.         # Help button (always visible)
  414.         screen.setImageButton( "InterfaceHelpButton", ArtFileMgr.getInterfaceArtInfo("INTERFACE_GENERAL_CIVILOPEDIA_ICON").getPath(), xResolution - 28, 2, 24, 24, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_CIVILOPEDIA).getActionInfoIndex(), -1 )
  415.         screen.hide( "InterfaceHelpButton" )
  416.  
  417.         screen.setImageButton( "MainMenuButton", ArtFileMgr.getInterfaceArtInfo("INTERFACE_GENERAL_MENU_ICON").getPath(), xResolution - 54, 2, 24, 24, WidgetTypes.WIDGET_MENU_ICON, -1, -1 )
  418.         screen.hide( "MainMenuButton" )
  419.  
  420.         # Globeview buttons
  421.         self.createGlobeviewButtons( )
  422.  
  423.         screen.addMultiListControlGFC( "BottomButtonContainer", u"", iMultiListXL, yResolution - 113, xResolution - (iMultiListXL+iMultiListXR), 100, 4, 48, 48, TableStyles.TABLE_STYLE_STANDARD )        
  424.         screen.hide( "BottomButtonContainer" )
  425.  
  426.         # *********************************************************************************
  427.         # PLOT LIST BUTTONS
  428.         # *********************************************************************************
  429.  
  430.         for i in range(gc.getDefineINT("MAX_PLOT_LIST_SIZE")):
  431.             szString = "PlotListButton" + str(i)
  432.             screen.addCheckBoxGFC( szString, ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTONS_GOVERNOR").getPath(), ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(), 315 + (i * 34), yResolution - 169, 32, 32, WidgetTypes.WIDGET_PLOT_LIST, i, -1, ButtonStyles.BUTTON_STYLE_LABEL )
  433.             screen.hide( szString )
  434.  
  435.         # End Turn Text        
  436.         screen.setLabel( "EndTurnText", "Background", u"", CvUtil.FONT_CENTER_JUSTIFY, 0, yResolution - 188, -0.1, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  437.         screen.setHitTest( "EndTurnText", HitTestTypes.HITTEST_NOHIT )
  438.  
  439.         # Three states for end turn button...
  440.         screen.setImageButton( "EndTurnButton", "", xResolution - (iEndOfTurnButtonSize/2) - iEndOfTurnPosX, yResolution - (iEndOfTurnButtonSize/2) - iEndOfTurnPosY, iEndOfTurnButtonSize, iEndOfTurnButtonSize, WidgetTypes.WIDGET_END_TURN, -1, -1 )
  441.         screen.setStyle( "EndTurnButton", "Button_HUDEndTurn_Style" )
  442.         screen.setEndTurnState( "EndTurnButton", "Red" )
  443.         screen.hide( "EndTurnButton" )
  444.  
  445.         # *********************************************************************************
  446.         # RESEARCH BUTTONS
  447.         # *********************************************************************************
  448.  
  449.         i = 0
  450.         for i in range( gc.getNumTechInfos() ):
  451.             szName = "ResearchButton" + str(i)
  452.             screen.setImageButton( szName, gc.getTechInfo(i).getButton(), 0, 0, 32, 32, WidgetTypes.WIDGET_RESEARCH, i, -1 )
  453.             screen.hide( szName )
  454.  
  455.         i = 0
  456.         for i in range(gc.getNumReligionInfos()):
  457.             szName = "ReligionButton" + str(i)
  458.             screen.setImageButton( szName, gc.getReligionInfo(i).getTechButton(), 0, 0, 32, 32, WidgetTypes.WIDGET_RESEARCH, gc.getReligionInfo(i).getTechPrereq(), -1 )
  459.             screen.hide( szName )
  460.         
  461.         # *********************************************************************************
  462.         # CITIZEN BUTTONS
  463.         # *********************************************************************************
  464.  
  465.         szHideCitizenList = []
  466.  
  467.         # Angry Citizens
  468.         i = 0
  469.         for i in range(MAX_CITIZEN_BUTTONS):
  470.             szName = "AngryCitizen" + str(i)
  471.             screen.setImageButton( szName, ArtFileMgr.getInterfaceArtInfo("INTERFACE_ANGRYCITIZEN_TEXTURE").getPath(), xResolution - 74 - (34 * i), yResolution - 248, 32, 32, WidgetTypes.WIDGET_ANGRY_CITIZEN, -1, -1 )
  472.             screen.hide( szName )
  473.             
  474.         iCount = 0
  475.  
  476.         # Increase Specialists...
  477.         i = 0
  478.         for i in range( gc.getNumSpecialistInfos() ):
  479.             if (gc.getSpecialistInfo(i).isVisible()):
  480.                 szName = "IncreaseSpecialist" + str(i)
  481.                 screen.setButtonGFC( szName, u"", "", xResolution - 38, (yResolution - 282 - (34 * iCount)), 20, 20, WidgetTypes.WIDGET_CHANGE_SPECIALIST, i, 1, ButtonStyles.BUTTON_STYLE_CITY_PLUS )
  482.                 screen.hide( szName )
  483.  
  484.                 iCount = iCount + 1
  485.  
  486.         iCount = 0
  487.  
  488.         # Decrease specialists
  489.         i = 0
  490.         for i in range( gc.getNumSpecialistInfos() ):
  491.             if (gc.getSpecialistInfo(i).isVisible()):
  492.                 szName = "DecreaseSpecialist" + str(i)
  493.                 screen.setButtonGFC( szName, u"", "", xResolution - 38, (yResolution - 265 - (34 * iCount)), 20, 20, WidgetTypes.WIDGET_CHANGE_SPECIALIST, i, -1, ButtonStyles.BUTTON_STYLE_CITY_MINUS )
  494.                 screen.hide( szName )
  495.  
  496.                 iCount = iCount + 1
  497.  
  498.         iCount = 0
  499.  
  500.         # Citizen Buttons
  501.         i = 0
  502.         for i in range( gc.getNumSpecialistInfos() ):
  503.         
  504.             if (gc.getSpecialistInfo(i).isVisible()):
  505.             
  506.                 szName = "CitizenDisabledButton" + str(i)
  507.                 screen.setImageButton( szName, gc.getSpecialistInfo(i).getTexture(), xResolution - 74, (yResolution - 282 - (34 * i)), 32, 32, WidgetTypes.WIDGET_DISABLED_CITIZEN, i, -1 )
  508.                 screen.enable( szName, False )
  509.                 screen.hide( szName )
  510.  
  511.                 for j in range(MAX_CITIZEN_BUTTONS):
  512.                     szName = "CitizenButton" + str((i * 100) + j)
  513.                     screen.addCheckBoxGFC( szName, gc.getSpecialistInfo(i).getTexture(), "", xResolution - 74 - (34 * j), (yResolution - 282 - (34 * i)), 32, 32, WidgetTypes.WIDGET_CITIZEN, i, j, ButtonStyles.BUTTON_STYLE_LABEL )
  514.                     screen.hide( szName )
  515.  
  516.         # **********************************************************
  517.         # GAME DATA STRINGS
  518.         # **********************************************************
  519.  
  520.         szGameDataList = []
  521.         
  522.         screen.addStackedBarGFC( "ResearchBar", 268 + ( (xResolution - 1024) / 2 ), 2, 487, iStackBarHeight, InfoBarTypes.NUM_INFOBAR_TYPES, WidgetTypes.WIDGET_RESEARCH, -1, -1 )
  523.         screen.setStackedBarColors( "ResearchBar", InfoBarTypes.INFOBAR_STORED, gc.getInfoTypeForString("COLOR_RESEARCH_STORED") )
  524.         screen.setStackedBarColors( "ResearchBar", InfoBarTypes.INFOBAR_RATE, gc.getInfoTypeForString("COLOR_RESEARCH_RATE") )
  525.         screen.setStackedBarColors( "ResearchBar", InfoBarTypes.INFOBAR_RATE_EXTRA, gc.getInfoTypeForString("COLOR_EMPTY") )
  526.         screen.setStackedBarColors( "ResearchBar", InfoBarTypes.INFOBAR_EMPTY, gc.getInfoTypeForString("COLOR_EMPTY") )
  527.         screen.hide( "ResearchBar" )
  528.         
  529.         # *********************************************************************************
  530.         # SELECTION DATA BUTTONS/STRINGS
  531.         # *********************************************************************************
  532.  
  533.         szHideSelectionDataList = []
  534.  
  535.         screen.addStackedBarGFC( "PopulationBar", iCityCenterRow1X, iCityCenterRow1Y-4, xResolution - (iCityCenterRow1X*2), iStackBarHeight, InfoBarTypes.NUM_INFOBAR_TYPES, WidgetTypes.WIDGET_HELP_POPULATION, -1, -1 )
  536.         screen.setStackedBarColors( "PopulationBar", InfoBarTypes.INFOBAR_STORED, gc.getYieldInfo(YieldTypes.YIELD_FOOD).getColorType() )
  537.         screen.setStackedBarColorsAlpha( "PopulationBar", InfoBarTypes.INFOBAR_RATE, gc.getYieldInfo(YieldTypes.YIELD_FOOD).getColorType(), 0.8 )
  538.         screen.setStackedBarColors( "PopulationBar", InfoBarTypes.INFOBAR_RATE_EXTRA, gc.getInfoTypeForString("COLOR_NEGATIVE_RATE") )
  539.         screen.setStackedBarColors( "PopulationBar", InfoBarTypes.INFOBAR_EMPTY, gc.getInfoTypeForString("COLOR_EMPTY") )
  540.         screen.hide( "PopulationBar" )
  541.         
  542.         screen.addStackedBarGFC( "ProductionBar", iCityCenterRow2X, iCityCenterRow2Y-4, xResolution - (iCityCenterRow2X*2), iStackBarHeight, InfoBarTypes.NUM_INFOBAR_TYPES, WidgetTypes.WIDGET_HELP_PRODUCTION, -1, -1 )
  543.         screen.setStackedBarColors( "ProductionBar", InfoBarTypes.INFOBAR_STORED, gc.getYieldInfo(YieldTypes.YIELD_PRODUCTION).getColorType() )
  544.         screen.setStackedBarColorsAlpha( "ProductionBar", InfoBarTypes.INFOBAR_RATE, gc.getYieldInfo(YieldTypes.YIELD_PRODUCTION).getColorType(), 0.8 )
  545.         screen.setStackedBarColors( "ProductionBar", InfoBarTypes.INFOBAR_RATE_EXTRA, gc.getYieldInfo(YieldTypes.YIELD_FOOD).getColorType() )
  546.         screen.setStackedBarColors( "ProductionBar", InfoBarTypes.INFOBAR_EMPTY, gc.getInfoTypeForString("COLOR_EMPTY") )
  547.         screen.hide( "ProductionBar" )
  548.         
  549.         screen.addStackedBarGFC( "GreatPeopleBar", xResolution - 246, yResolution - 180, 194, iStackBarHeight, InfoBarTypes.NUM_INFOBAR_TYPES, WidgetTypes.WIDGET_HELP_GREAT_PEOPLE, -1, -1 )
  550.         screen.setStackedBarColors( "GreatPeopleBar", InfoBarTypes.INFOBAR_STORED, gc.getInfoTypeForString("COLOR_GREAT_PEOPLE_STORED") )
  551.         screen.setStackedBarColors( "GreatPeopleBar", InfoBarTypes.INFOBAR_RATE, gc.getInfoTypeForString("COLOR_GREAT_PEOPLE_RATE") )
  552.         screen.setStackedBarColors( "GreatPeopleBar", InfoBarTypes.INFOBAR_RATE_EXTRA, gc.getInfoTypeForString("COLOR_EMPTY") )
  553.         screen.setStackedBarColors( "GreatPeopleBar", InfoBarTypes.INFOBAR_EMPTY, gc.getInfoTypeForString("COLOR_EMPTY") )
  554.         screen.hide( "GreatPeopleBar" )
  555.         
  556.         screen.addStackedBarGFC( "CultureBar", 16, yResolution - 188, 220, iStackBarHeight, InfoBarTypes.NUM_INFOBAR_TYPES, WidgetTypes.WIDGET_HELP_CULTURE, -1, -1 )
  557.         screen.setStackedBarColors( "CultureBar", InfoBarTypes.INFOBAR_STORED, gc.getInfoTypeForString("COLOR_CULTURE_STORED") )
  558.         screen.setStackedBarColors( "CultureBar", InfoBarTypes.INFOBAR_RATE, gc.getInfoTypeForString("COLOR_CULTURE_RATE") )
  559.         screen.setStackedBarColors( "CultureBar", InfoBarTypes.INFOBAR_RATE_EXTRA, gc.getInfoTypeForString("COLOR_EMPTY") )
  560.         screen.setStackedBarColors( "CultureBar", InfoBarTypes.INFOBAR_EMPTY, gc.getInfoTypeForString("COLOR_EMPTY") )
  561.         screen.hide( "CultureBar" )
  562.  
  563.         # Holy City Overlay
  564.         i = 0
  565.         for i in range( gc.getNumReligionInfos() ):
  566.             xCoord = xResolution - 242 + (i * 34)
  567.             yCoord = 42
  568.             szName = "ReligionHolyCityDDS" + str(i)
  569.             screen.addDDSGFC( szName, ArtFileMgr.getInterfaceArtInfo("INTERFACE_HOLYCITY_OVERLAY").getPath(), xCoord, yCoord, 24, 24, WidgetTypes.WIDGET_HELP_RELIGION_CITY, i, -1 )
  570.             screen.hide( szName )
  571.  
  572.         screen.addStackedBarGFC( "NationalityBar", 16, yResolution - 214, 220, iStackBarHeight, InfoBarTypes.NUM_INFOBAR_TYPES, WidgetTypes.WIDGET_HELP_NATIONALITY, -1, -1 )
  573.         screen.hide( "NationalityBar" )
  574.  
  575.         screen.setButtonGFC( "CityScrollMinus", u"", "", 274, 32, 32, 32, WidgetTypes.WIDGET_CITY_SCROLL, -1, -1, ButtonStyles.BUTTON_STYLE_ARROW_LEFT )
  576.         screen.hide( "CityScrollMinus" )
  577.  
  578.         screen.setButtonGFC( "CityScrollPlus", u"", "", 288, 32, 32, 32, WidgetTypes.WIDGET_CITY_SCROLL, 1, -1, ButtonStyles.BUTTON_STYLE_ARROW_RIGHT )
  579.         screen.hide( "CityScrollPlus" )
  580.         
  581.         screen.setButtonGFC( "PlotListMinus", u"", "", 315 + ( ( gc.getDefineINT("MAX_PLOT_LIST_SIZE") ) * 34), yResolution - 171, 32, 32, WidgetTypes.WIDGET_PLOT_LIST_SHIFT, -1, -1, ButtonStyles.BUTTON_STYLE_ARROW_LEFT )
  582.         screen.hide( "PlotListMinus" )
  583.  
  584.         screen.setButtonGFC( "PlotListPlus", u"", "", 298 + ( ( gc.getDefineINT("MAX_PLOT_LIST_SIZE") + 1 ) * 34), yResolution - 171, 32, 32, WidgetTypes.WIDGET_PLOT_LIST_SHIFT, 1, -1, ButtonStyles.BUTTON_STYLE_ARROW_RIGHT )
  585.         screen.hide( "PlotListPlus" )
  586.  
  587.         screen.addPanel( "TradeRouteListBackground", u"", u"", True, False, 10, 138, 238, 30, PanelStyles.PANEL_STYLE_STANDARD )
  588.         screen.setStyle( "TradeRouteListBackground", "Panel_City_Header_Style" )
  589.         screen.hide( "TradeRouteListBackground" )
  590.  
  591.         screen.setLabel( "TradeRouteListLabel", "Background", localText.getText("TXT_KEY_HEADING_TRADEROUTE_LIST", ()), CvUtil.FONT_CENTER_JUSTIFY, 129, 146, -0.1, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  592.         screen.hide( "TradeRouteListLabel" )
  593.  
  594.         screen.addPanel( "BuildingListBackground", u"", u"", True, False, 10, 268, 238, 30, PanelStyles.PANEL_STYLE_STANDARD )
  595.         screen.setStyle( "BuildingListBackground", "Panel_City_Header_Style" )
  596.         screen.hide( "BuildingListBackground" )
  597.  
  598.         screen.setLabel( "BuildingListLabel", "Background", localText.getText("TXT_KEY_CONCEPT_BUILDINGS", ()), CvUtil.FONT_CENTER_JUSTIFY, 129, 276, -0.1, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  599.         screen.hide( "BuildingListLabel" )
  600.  
  601.         # *********************************************************************************
  602.         # UNIT INFO ELEMENTS
  603.         # *********************************************************************************
  604.  
  605.         i = 0
  606.         for i in range(gc.getNumPromotionInfos()):
  607.             szName = "PromotionButton" + str(i)
  608.             screen.addDDSGFC( szName, gc.getPromotionInfo(i).getButton(), 180, yResolution - 18, 24, 24, WidgetTypes.WIDGET_ACTION, gc.getPromotionInfo(i).getActionInfoIndex(), -1 )
  609.             screen.hide( szName )
  610.             
  611.         # *********************************************************************************
  612.         # SCORES
  613.         # *********************************************************************************
  614.         
  615.         screen.addPanel( "ScoreBackground", u"", u"", True, False, 0, 0, 0, 0, PanelStyles.PANEL_STYLE_HUD_HELP )
  616.         screen.hide( "ScoreBackground" )
  617.  
  618.         for i in range( 20 ):
  619.             szName = "ScoreText" + str(i)
  620.             screen.setText( szName, "Background", u"", CvUtil.FONT_RIGHT_JUSTIFY, 996, 622, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_CONTACT_CIV, i, -1 )
  621.             screen.hide( szName )
  622.             
  623.         # This should be a forced redraw screen
  624.         screen.setForcedRedraw( True )
  625.         
  626.         # This should show the screen immidiately and pass input to the game
  627.         screen.showScreen(PopupStates.POPUPSTATE_IMMEDIATE, True)
  628.         
  629.         szHideList = []
  630.         
  631.         szHideList.append( "CreateGroup" )
  632.         szHideList.append( "DeleteGroup" )
  633.  
  634.         # City Tabs
  635.         for i in range( g_NumCityTabTypes ):
  636.             szButtonID = "CityTab" + str(i)
  637.             szHideList.append( szButtonID )
  638.                     
  639.         # Automate Production Button
  640.         szHideList.append( "AutomateProduction" )
  641.  
  642.         # Automate Citizens Button
  643.         szHideList.append( "AutomateCitizens" )
  644.  
  645.         # Set Emphasize buttons
  646.         i = 0
  647.         for i in range (g_NumEmphasizeInfos):
  648.             szButtonID = "Emphasize" + str(i)
  649.             szHideList.append( szButtonID )
  650.  
  651.         # Conscript button
  652.         szHideList.append( "Conscript" )
  653.  
  654.         for i in range( g_NumHurryInfos ):
  655.             szButtonID = "Hurry" + str(i)
  656.             szHideList.append( szButtonID )
  657.  
  658.         szHideList.append( "Hurry0" )
  659.         szHideList.append( "Hurry1" )
  660.         
  661.         screen.registerHideList( szHideList, len(szHideList), 0 )
  662.  
  663.         return 0
  664.  
  665.     # Will update the screen (every 250 MS)
  666.     def updateScreen(self):
  667.         
  668.         global g_szTimeText
  669.         global g_iTimeTextCounter
  670.  
  671.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  672.         
  673.         # Find out our resolution
  674.         xResolution = screen.getXResolution()
  675.         yResolution = screen.getYResolution()
  676.         
  677.         # This should recreate the minimap on load games and returns if already exists -JW
  678.         screen.initMinimap( xResolution - 210, xResolution - 9, yResolution - 131, yResolution - 9, -0.1 )
  679.  
  680.         messageControl = CyMessageControl()
  681.         
  682.         bShow = False
  683.         
  684.         # Hide all interface widgets        
  685.         #screen.hide( "EndTurnText" )
  686.  
  687.         if ( CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_MINIMAP_ONLY ):
  688.             if (gc.getGame().isPaused()):
  689.                 # Pause overrides other messages
  690.                 acOutput = localText.getText("SYSTEM_GAME_PAUSED", (gc.getPlayer(gc.getGame().getPausePlayer()).getNameKey(), ))
  691.                 #screen.modifyLabel( "EndTurnText", acOutput, CvUtil.FONT_CENTER_JUSTIFY )
  692.                 screen.setEndTurnState( "EndTurnText", acOutput )
  693.                 bShow = True
  694.             elif (messageControl.GetFirstBadConnection() != -1):
  695.                 # Waiting on a bad connection to resolve
  696.                 if (messageControl.GetConnState(messageControl.GetFirstBadConnection()) == 1):
  697.                     acOutput = localText.getText("SYSTEM_WAITING_FOR_PLAYER", (gc.getPlayer(messageControl.GetFirstBadConnection()).getNameKey(), messageControl.GetFirstBadConnection()))
  698.                     #screen.modifyLabel( "EndTurnText", acOutput, CvUtil.FONT_CENTER_JUSTIFY )
  699.                     screen.setEndTurnState( "EndTurnText", acOutput )
  700.                     bShow = True
  701.                 elif (messageControl.GetConnState(messageControl.GetFirstBadConnection()) == 2):
  702.                     acOutput = localText.getText("SYSTEM_PLAYER_JOINING", (gc.getPlayer(messageControl.GetFirstBadConnection()).getNameKey(), messageControl.GetFirstBadConnection()))
  703.                     #screen.modifyLabel( "EndTurnText", acOutput, CvUtil.FONT_CENTER_JUSTIFY )
  704.                     screen.setEndTurnState( "EndTurnText", acOutput )
  705.                     bShow = True
  706.             else:
  707.                 # Flash select messages if no popups are present
  708.                 if ( CyInterface().shouldDisplayReturn() ):
  709.                     acOutput = localText.getText("SYSTEM_RETURN", ())
  710.                     #screen.modifyLabel( "EndTurnText", acOutput, CvUtil.FONT_CENTER_JUSTIFY )
  711.                     screen.setEndTurnState( "EndTurnText", acOutput )
  712.                     bShow = True
  713.                 elif ( CyInterface().shouldDisplayWaitingOthers() ):
  714.                     acOutput = localText.getText("SYSTEM_WAITING", ())
  715.                     #screen.modifyLabel( "EndTurnText", acOutput, CvUtil.FONT_CENTER_JUSTIFY )
  716.                     screen.setEndTurnState( "EndTurnText", acOutput )
  717.                     bShow = True
  718.                 elif ( CyInterface().shouldDisplayEndTurn() ):
  719.                     acOutput = localText.getText("SYSTEM_END_TURN", ())
  720.                     #screen.modifyLabel( "EndTurnText", acOutput, CvUtil.FONT_CENTER_JUSTIFY )
  721.                     screen.setEndTurnState( "EndTurnText", acOutput )
  722.                     bShow = True
  723.                 elif ( CyInterface().shouldDisplayWaitingYou() ):
  724.                     acOutput = localText.getText("SYSTEM_WAITING_FOR_YOU", ())
  725.                     #screen.modifyLabel( "EndTurnText", acOutput, CvUtil.FONT_CENTER_JUSTIFY )
  726.                     screen.setEndTurnState( "EndTurnText", acOutput )
  727.                     bShow = True
  728.  
  729.         if ( bShow ):
  730.             screen.showEndTurn( "EndTurnText" )
  731.             if ( CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_SHOW or CyInterface().isCityScreenUp() ):
  732.                 screen.moveItem( "EndTurnText", 0, yResolution - 194, -0.1 )
  733.             else:
  734.                 screen.moveItem( "EndTurnText", 0, yResolution - 86, -0.1 )
  735.         else:
  736.             screen.hideEndTurn( "EndTurnText" )
  737.  
  738.         self.updateEndTurnButton()
  739.         
  740.         # If clock was just turned on then display the clock text immediately instead of waiting the normal amt of time
  741.         if (CyUserProfile().wasClockJustTurnedOn()):
  742.             g_iTimeTextCounter = 15.0
  743.             CyUserProfile().setClockJustTurnedOn(false)
  744.         
  745.         if (g_iTimeTextCounter >= 30.0):        # 15 seconds
  746.             g_iTimeTextCounter = 0.0
  747.             self.updateTimeText(false)
  748.             screen.setLabel( "TimeText", "Background", g_szTimeText, CvUtil.FONT_RIGHT_JUSTIFY, xResolution - 56, 6, -0.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  749.             screen.show( "TimeText" )
  750.         elif (g_iTimeTextCounter >= 15.0):        # Another 15 Seconds
  751.             self.updateTimeText(true)
  752.             screen.setLabel( "TimeText", "Background", g_szTimeText, CvUtil.FONT_RIGHT_JUSTIFY, xResolution - 56, 6, -0.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  753.             screen.show( "TimeText" )
  754.         
  755.         g_iTimeTextCounter += 0.25
  756.  
  757.         return 0
  758.  
  759.     # Will redraw the interface
  760.     def redraw( self ):
  761.  
  762.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  763.  
  764.         # Check Dirty Bits, see what we need to redraw...
  765.         if (CyInterface().isDirty(InterfaceDirtyBits.PercentButtons_DIRTY_BIT) == True):
  766.             # Percent Buttons
  767.             self.updatePercentButtons()
  768.             CyInterface().setDirty(InterfaceDirtyBits.PercentButtons_DIRTY_BIT, False)
  769.         if (CyInterface().isDirty(InterfaceDirtyBits.Flag_DIRTY_BIT) == True):
  770.             # Percent Buttons
  771.             self.updateFlag()
  772.             CyInterface().setDirty(InterfaceDirtyBits.Flag_DIRTY_BIT, False)
  773.         if ( CyInterface().isDirty(InterfaceDirtyBits.MiscButtons_DIRTY_BIT) == True ):
  774.             # Miscellaneous buttons (civics screen, etc)
  775.             self.updateMiscButtons()
  776.             CyInterface().setDirty(InterfaceDirtyBits.MiscButtons_DIRTY_BIT, False)
  777.         if ( CyInterface().isDirty(InterfaceDirtyBits.PlotListButtons_DIRTY_BIT) == True ):
  778.             # Plot List Buttons Dirty
  779.             self.updatePlotListButtons()
  780.             CyInterface().setDirty(InterfaceDirtyBits.PlotListButtons_DIRTY_BIT, False)
  781.         if ( CyInterface().isDirty(InterfaceDirtyBits.SelectionButtons_DIRTY_BIT) == True ):
  782.             # Selection Buttons Dirty
  783.             self.updateSelectionButtons()
  784.             CyInterface().setDirty(InterfaceDirtyBits.SelectionButtons_DIRTY_BIT, False)
  785.         if ( CyInterface().isDirty(InterfaceDirtyBits.InfoPane_DIRTY_BIT) == True ):
  786.             # Info Pane Dirty Bit
  787.             self.updateInfoPaneStrings()
  788.             CyInterface().setDirty(InterfaceDirtyBits.InfoPane_DIRTY_BIT, False)
  789.         if ( CyInterface().isDirty(InterfaceDirtyBits.ResearchButtons_DIRTY_BIT) == True ):
  790.             # Research Buttons Dirty
  791.             self.updateResearchButtons()
  792.             CyInterface().setDirty(InterfaceDirtyBits.ResearchButtons_DIRTY_BIT, False)
  793.         if ( CyInterface().isDirty(InterfaceDirtyBits.CitizenButtons_DIRTY_BIT) == True ):
  794.             # Citizen Buttons Dirty
  795.             self.updateCitizenButtons()
  796.             CyInterface().setDirty(InterfaceDirtyBits.CitizenButtons_DIRTY_BIT, False)
  797.         if ( CyInterface().isDirty(InterfaceDirtyBits.GameData_DIRTY_BIT) == True ):
  798.             # Game Data Strings Dirty
  799.             self.updateGameDataStrings()
  800.             CyInterface().setDirty(InterfaceDirtyBits.GameData_DIRTY_BIT, False)
  801.         if ( CyInterface().isDirty(InterfaceDirtyBits.Help_DIRTY_BIT) == True ):
  802.             # Help Dirty bit
  803.             self.updateHelpStrings()
  804.             CyInterface().setDirty(InterfaceDirtyBits.Help_DIRTY_BIT, False)
  805.         if ( CyInterface().isDirty(InterfaceDirtyBits.CityScreen_DIRTY_BIT) == True ):
  806.             # Selection Data Dirty Bit
  807.             self.updateCityScreen()
  808.             CyInterface().setDirty(InterfaceDirtyBits.CityScreen_DIRTY_BIT, False)
  809.         if ( CyInterface().isDirty(InterfaceDirtyBits.Score_DIRTY_BIT) == True or CyInterface().checkFlashUpdate() ):
  810.             # Scores!
  811.             self.updateScoreStrings()
  812.             CyInterface().setDirty(InterfaceDirtyBits.Score_DIRTY_BIT, False)
  813.         if ( CyInterface().isDirty(InterfaceDirtyBits.GlobeInfo_DIRTY_BIT) == True ):
  814.             # Globeview and Globelayer buttons
  815.             CyInterface().setDirty(InterfaceDirtyBits.GlobeInfo_DIRTY_BIT, False)
  816.             self.updateGlobeviewButtons()
  817.         
  818.         return 0
  819.  
  820.     # Will update the percent buttons
  821.     def updatePercentButtons( self ):
  822.  
  823.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  824.  
  825.         for iI in range( CommerceTypes.NUM_COMMERCE_TYPES ):
  826.             szString = "IncreasePercent" + str(iI)
  827.             screen.hide( szString )
  828.             szString = "DecreasePercent" + str(iI)
  829.             screen.hide( szString )
  830.  
  831.         pHeadSelectedCity = CyInterface().getHeadSelectedCity()
  832.  
  833.         if ( not CyInterface().isCityScreenUp() or ( pHeadSelectedCity.getOwner() == gc.getGame().getActivePlayer() ) or gc.getGame().isDebugMode() ):
  834.             iCount = 0
  835.  
  836.             if ( CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_MINIMAP_ONLY ):
  837.                 for iI in range( CommerceTypes.NUM_COMMERCE_TYPES ):
  838.                     # Intentional offset...
  839.                     eCommerce = (iI + 1) % CommerceTypes.NUM_COMMERCE_TYPES
  840.  
  841.                     if (gc.getActivePlayer().isCommerceFlexible(eCommerce) or (CyInterface().isCityScreenUp() and (eCommerce == CommerceTypes.COMMERCE_GOLD))):
  842.                         szString1 = "IncreasePercent" + str(eCommerce)
  843.                         screen.setButtonGFC( szString1, u"", "", 70, 50 + (19 * iCount), 20, 20, WidgetTypes.WIDGET_CHANGE_PERCENT, eCommerce, gc.getDefineINT("COMMERCE_PERCENT_CHANGE_INCREMENTS"), ButtonStyles.BUTTON_STYLE_CITY_PLUS )
  844.                         screen.show( szString1 )
  845.                         szString2 = "DecreasePercent" + str(eCommerce)
  846.                         screen.setButtonGFC( szString2, u"", "", 90, 50 + (19 * iCount), 20, 20, WidgetTypes.WIDGET_CHANGE_PERCENT, eCommerce, -gc.getDefineINT("COMMERCE_PERCENT_CHANGE_INCREMENTS"), ButtonStyles.BUTTON_STYLE_CITY_MINUS )
  847.                         screen.show( szString2 )
  848.  
  849.                         iCount = iCount + 1
  850.  
  851.                         if (gc.getActivePlayer().isCommerceFlexible(eCommerce)):
  852.                             screen.enable( szString1, True )
  853.                             screen.enable( szString2, True )
  854.                         else:
  855.                             screen.enable( szString1, False )
  856.                             screen.enable( szString2, False )
  857.                             
  858.         return 0
  859.  
  860.     # Will update the end Turn Button
  861.     def updateEndTurnButton( self ):
  862.  
  863.         global g_eEndTurnButtonState
  864.         
  865.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  866.  
  867.         if ( CyInterface().shouldDisplayEndTurnButton() and CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_SHOW ):
  868.         
  869.             eState = CyInterface().getEndTurnState()
  870.             
  871.             bShow = False
  872.             
  873.             if ( eState == EndTurnButtonStates.END_TURN_OVER_HIGHLIGHT ):
  874.                 screen.setEndTurnState( "EndTurnButton", u"Red" )
  875.                 bShow = True
  876.             elif ( eState == EndTurnButtonStates.END_TURN_OVER_DARK ):
  877.                 screen.setEndTurnState( "EndTurnButton", u"Red" )
  878.                 bShow = True
  879.             elif ( eState == EndTurnButtonStates.END_TURN_GO ):
  880.                 screen.setEndTurnState( "EndTurnButton", u"Green" )
  881.                 bShow = True
  882.             
  883.             if ( bShow ):
  884.                 screen.showEndTurn( "EndTurnButton" )
  885.             else:
  886.                 screen.hideEndTurn( "EndTurnButton" )
  887.             
  888.             if ( g_eEndTurnButtonState == eState ):
  889.                 return
  890.                 
  891.             g_eEndTurnButtonState = eState
  892.             
  893.         else:
  894.             screen.hideEndTurn( "EndTurnButton" )
  895.  
  896.         return 0
  897.  
  898.     # Update the miscellaneous buttons
  899.     def updateMiscButtons( self ):
  900.     
  901.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  902.         
  903.         xResolution = screen.getXResolution()
  904.  
  905.         if ( CyInterface().shouldDisplayFlag() and CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_SHOW ):
  906.             screen.show( "CivilizationFlag" )
  907.             screen.show( "InterfaceHelpButton" )
  908.             screen.show( "MainMenuButton" )
  909.         else:
  910.             screen.hide( "CivilizationFlag" )
  911.             screen.hide( "InterfaceHelpButton" )
  912.             screen.hide( "MainMenuButton" )
  913.  
  914.         if ( CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_HIDE_ALL or CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_MINIMAP_ONLY ):
  915.             screen.hide( "InterfaceLeftBackgroundWidget" )
  916.             screen.hide( "InterfaceTopBackgroundWidget" )
  917.             screen.hide( "InterfaceCenterBackgroundWidget" )
  918.             screen.hide( "InterfaceRightBackgroundWidget" )
  919.             screen.hide( "MiniMapPanel" )
  920.             screen.hide( "InterfaceTopLeft" )
  921.             screen.hide( "InterfaceTopCenter" )
  922.             screen.hide( "InterfaceTopRight" )
  923.             screen.hide( "TurnLogButton" )
  924.             screen.hide( "DomesticAdvisorButton" )
  925.             screen.hide( "ForeignAdvisorButton" )
  926.             screen.hide( "TechAdvisorButton" )
  927.             screen.hide( "CivicsAdvisorButton" )
  928.             screen.hide( "ReligiousAdvisorButton" )
  929.             screen.hide( "FinanceAdvisorButton" )
  930.             screen.hide( "MilitaryAdvisorButton" )
  931.             screen.hide( "VictoryAdvisorButton" )
  932.             screen.hide( "InfoAdvisorButton" )
  933.             
  934.         elif ( CyInterface().isCityScreenUp() ):
  935.             screen.show( "InterfaceLeftBackgroundWidget" )
  936.             screen.show( "InterfaceTopBackgroundWidget" )
  937.             screen.show( "InterfaceCenterBackgroundWidget" )
  938.             screen.show( "InterfaceRightBackgroundWidget" )
  939.             screen.show( "MiniMapPanel" )
  940.             screen.hide( "InterfaceTopLeft" )
  941.             screen.hide( "InterfaceTopCenter" )
  942.             screen.hide( "InterfaceTopRight" )
  943.             screen.hide( "TurnLogButton" )
  944.             screen.hide( "DomesticAdvisorButton" )
  945.             screen.hide( "ForeignAdvisorButton" )
  946.             screen.hide( "TechAdvisorButton" )
  947.             screen.hide( "CivicsAdvisorButton" )
  948.             screen.hide( "ReligiousAdvisorButton" )
  949.             screen.hide( "FinanceAdvisorButton" )
  950.             screen.hide( "MilitaryAdvisorButton" )
  951.             screen.hide( "VictoryAdvisorButton" )
  952.             screen.hide( "InfoAdvisorButton" )
  953.             
  954.         elif ( CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_HIDE ):
  955.             screen.hide( "InterfaceLeftBackgroundWidget" )
  956.             screen.show( "InterfaceTopBackgroundWidget" )
  957.             screen.hide( "InterfaceCenterBackgroundWidget" )
  958.             screen.hide( "InterfaceRightBackgroundWidget" )
  959.             screen.hide( "MiniMapPanel" )
  960.             screen.show( "InterfaceTopLeft" )
  961.             screen.show( "InterfaceTopCenter" )
  962.             screen.show( "InterfaceTopRight" )
  963.             screen.show( "TurnLogButton" )
  964.             screen.show( "DomesticAdvisorButton" )
  965.             screen.show( "ForeignAdvisorButton" )
  966.             screen.show( "TechAdvisorButton" )
  967.             screen.show( "CivicsAdvisorButton" )
  968.             screen.show( "ReligiousAdvisorButton" )
  969.             screen.show( "FinanceAdvisorButton" )
  970.             screen.show( "MilitaryAdvisorButton" )
  971.             screen.show( "VictoryAdvisorButton" )
  972.             screen.show( "InfoAdvisorButton" )
  973.             screen.moveToFront( "TurnLogButton" )
  974.             screen.moveToFront( "DomesticAdvisorButton" )
  975.             screen.moveToFront( "ForeignAdvisorButton" )
  976.             screen.moveToFront( "TechAdvisorButton" )
  977.             screen.moveToFront( "CivicsAdvisorButton" )
  978.             screen.moveToFront( "ReligiousAdvisorButton" )
  979.             screen.moveToFront( "FinanceAdvisorButton" )
  980.             screen.moveToFront( "MilitaryAdvisorButton" )
  981.             screen.moveToFront( "VictoryAdvisorButton" )
  982.             screen.moveToFront( "InfoAdvisorButton" )
  983.             
  984.         elif ( CyEngine().isGlobeviewUp() ):
  985.             screen.hide( "InterfaceLeftBackgroundWidget" )
  986.             screen.hide( "InterfaceTopBackgroundWidget" )
  987.             screen.hide( "InterfaceCenterBackgroundWidget" )
  988.             screen.show( "InterfaceRightBackgroundWidget" )
  989.             screen.show( "MiniMapPanel" )
  990.             screen.show( "InterfaceTopLeft" )
  991.             screen.show( "InterfaceTopCenter" )
  992.             screen.show( "InterfaceTopRight" )
  993.             screen.show( "TurnLogButton" )
  994.             screen.show( "DomesticAdvisorButton" )
  995.             screen.show( "ForeignAdvisorButton" )
  996.             screen.show( "TechAdvisorButton" )
  997.             screen.show( "CivicsAdvisorButton" )
  998.             screen.show( "ReligiousAdvisorButton" )
  999.             screen.show( "FinanceAdvisorButton" )
  1000.             screen.show( "MilitaryAdvisorButton" )
  1001.             screen.show( "VictoryAdvisorButton" )
  1002.             screen.show( "InfoAdvisorButton" )            
  1003.             screen.moveToFront( "TurnLogButton" )
  1004.             screen.moveToFront( "DomesticAdvisorButton" )
  1005.             screen.moveToFront( "ForeignAdvisorButton" )
  1006.             screen.moveToFront( "TechAdvisorButton" )
  1007.             screen.moveToFront( "CivicsAdvisorButton" )
  1008.             screen.moveToFront( "ReligiousAdvisorButton" )
  1009.             screen.moveToFront( "FinanceAdvisorButton" )
  1010.             screen.moveToFront( "MilitaryAdvisorButton" )
  1011.             screen.moveToFront( "VictoryAdvisorButton" )
  1012.             screen.moveToFront( "InfoAdvisorButton" )
  1013.             
  1014.         else:
  1015.             screen.show( "InterfaceLeftBackgroundWidget" )
  1016.             screen.show( "InterfaceTopBackgroundWidget" )
  1017.             screen.show( "InterfaceCenterBackgroundWidget" )
  1018.             screen.show( "InterfaceRightBackgroundWidget" )
  1019.             screen.show( "MiniMapPanel" )
  1020.             screen.show( "InterfaceTopLeft" )
  1021.             screen.show( "InterfaceTopCenter" )
  1022.             screen.show( "InterfaceTopRight" )
  1023.             screen.show( "TurnLogButton" )
  1024.             screen.show( "DomesticAdvisorButton" )
  1025.             screen.show( "ForeignAdvisorButton" )
  1026.             screen.show( "TechAdvisorButton" )
  1027.             screen.show( "CivicsAdvisorButton" )
  1028.             screen.show( "ReligiousAdvisorButton" )
  1029.             screen.show( "FinanceAdvisorButton" )
  1030.             screen.show( "MilitaryAdvisorButton" )
  1031.             screen.show( "VictoryAdvisorButton" )
  1032.             screen.show( "InfoAdvisorButton" )
  1033.             screen.moveToFront( "TurnLogButton" )
  1034.             screen.moveToFront( "DomesticAdvisorButton" )
  1035.             screen.moveToFront( "ForeignAdvisorButton" )
  1036.             screen.moveToFront( "TechAdvisorButton" )
  1037.             screen.moveToFront( "CivicsAdvisorButton" )
  1038.             screen.moveToFront( "ReligiousAdvisorButton" )
  1039.             screen.moveToFront( "FinanceAdvisorButton" )
  1040.             screen.moveToFront( "MilitaryAdvisorButton" )
  1041.             screen.moveToFront( "VictoryAdvisorButton" )
  1042.             screen.moveToFront( "InfoAdvisorButton" )
  1043.             
  1044.         screen.updateMinimapVisibility()
  1045.  
  1046.         return 0
  1047.  
  1048.     # Update plot List Buttons
  1049.     def updatePlotListButtons( self ):
  1050.  
  1051.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  1052.  
  1053.         yResolution = screen.getYResolution()
  1054.  
  1055.         bHandled = False
  1056.         if ( CyInterface().shouldDisplayUnitModel() and CyEngine().isGlobeviewUp() == false and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL ):
  1057.             if ( CyInterface().isCitySelection() ):
  1058.  
  1059.                 iOrders = CyInterface().getNumOrdersQueued()
  1060.  
  1061.                 for i in range( iOrders ):
  1062.                     if ( bHandled == False ):
  1063.                         if ( CyInterface().getOrderNodeType(i) == OrderTypes.ORDER_TRAIN ):
  1064.                             screen.addUnitGraphicGFC( "InterfaceUnitModel", CyInterface().getOrderNodeData1(i), 186, yResolution - 138, 105, 132, WidgetTypes.WIDGET_GENERAL, -1, -1,  -20, 30, 1, False )
  1065.                             bHandled = True
  1066.                         elif ( CyInterface().getOrderNodeType(i) == OrderTypes.ORDER_CONSTRUCT ):
  1067.                             screen.addBuildingGraphicGFC( "InterfaceUnitModel", CyInterface().getOrderNodeData1(i), 186, yResolution - 138, 105, 132, WidgetTypes.WIDGET_GENERAL, -1, -1,  -20, 30, 0.8, False )
  1068.                             bHandled = True
  1069.                         elif ( CyInterface().getOrderNodeType(i) == OrderTypes.ORDER_CREATE ):
  1070.                             screen.hide( "InterfaceUnitModel" )
  1071.                             bHandled = True
  1072.                         elif ( CyInterface().getOrderNodeType(i) == OrderTypes.ORDER_MAINTAIN ):
  1073.                             screen.hide( "InterfaceUnitModel" )
  1074.                             bHandled = True
  1075.                             
  1076.                 if ( not bHandled ):
  1077.                     screen.hide( "InterfaceUnitModel" )
  1078.                     bHandled = True
  1079.  
  1080.             elif ( CyInterface().getHeadSelectedUnit() ):
  1081.                 screen.addUnitGraphicGFC( "InterfaceUnitModel", CyInterface().getHeadSelectedUnit().getUnitType(), 186, yResolution - 138, 105, 132, WidgetTypes.WIDGET_UNIT_MODEL, CyInterface().getHeadSelectedUnit().getUnitType(), -1,  -20, 30, 1, False )
  1082.             else:
  1083.                 screen.hide( "InterfaceUnitModel" )
  1084.         else:
  1085.             screen.hide( "InterfaceUnitModel" )
  1086.             
  1087.         pPlot = CyInterface().getSelectionPlot()
  1088.  
  1089.         screen.hide( "PlotListMinus" )
  1090.         screen.hide( "PlotListPlus" )
  1091.  
  1092.         for i in range(gc.getDefineINT("MAX_PLOT_LIST_SIZE")):
  1093.             szString = "PlotListButton" + str(i)
  1094.             screen.hide( szString )
  1095.  
  1096.             # SF CHANGE
  1097.             szStringIcon = szString+"Icon"
  1098.             screen.hide( szStringIcon )
  1099.  
  1100.         if ( pPlot and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL and CyEngine().isGlobeviewUp() == False):
  1101.  
  1102.             iVisibleUnits = CyInterface().getNumVisibleUnits()
  1103.             iCount = -(CyInterface().getPlotListColumn())
  1104.  
  1105.             bLeftArrow = False
  1106.             bRightArrow = False
  1107.  
  1108.             if ( iVisibleUnits > 1 or CyInterface().isCitySelection() ):
  1109.                 for i in range(pPlot.getNumUnits()):
  1110.                     pLoopUnit = CyInterface().getInterfacePlotUnit(pPlot, i)
  1111.                     if (pLoopUnit):
  1112.  
  1113.                         if ((iCount == 0) and (CyInterface().getPlotListColumn() > 0)):
  1114.                             bLeftArrow = True
  1115.                         elif ((iCount == (gc.getDefineINT("MAX_PLOT_LIST_SIZE") - 1)) and ((iVisibleUnits - iCount - CyInterface().getPlotListColumn()) > 1)):
  1116.                             bRightArrow = True
  1117.  
  1118.                         if ((iCount >= 0) and (iCount < gc.getDefineINT("MAX_PLOT_LIST_SIZE"))):
  1119.                             if ((pLoopUnit.getTeam() != gc.getGame().getActiveTeam()) or pLoopUnit.isWaiting()):
  1120.                                 szFileName = ArtFileMgr.getInterfaceArtInfo("OVERLAY_FORTIFY").getPath()
  1121.                                 
  1122.                             elif (pLoopUnit.canMove()):
  1123.                                 if (pLoopUnit.hasMoved()):
  1124.                                     szFileName = ArtFileMgr.getInterfaceArtInfo("OVERLAY_HASMOVED").getPath()
  1125.                                 else:
  1126.                                     szFileName = ArtFileMgr.getInterfaceArtInfo("OVERLAY_MOVE").getPath()
  1127.                             else:
  1128.                                 szFileName = ArtFileMgr.getInterfaceArtInfo("OVERLAY_NOMOVE").getPath()
  1129.  
  1130.                             szString = "PlotListButton" + str(iCount)
  1131.                             screen.changeImageButton( szString, gc.getUnitInfo(pLoopUnit.getUnitType()).getButton() )
  1132.                             #screen.addCheckBoxGFC( szString, gc.getUnitInfo(pLoopUnit.getUnitType()).getButton(), ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(), 315 + (iCount * 34), yResolution - 169, 32, 32, WidgetTypes.WIDGET_PLOT_LIST, iCount + CyInterface().getPlotListColumn(), -1, ButtonStyles.BUTTON_STYLE_LABEL )
  1133.                             if ( pLoopUnit.getOwner() == gc.getGame().getActivePlayer() ):
  1134.                                 bEnable = True
  1135.                             else:
  1136.                                 bEnable = False
  1137.                             screen.enable(szString, bEnable)
  1138.  
  1139.                             if (pLoopUnit.IsSelected()):
  1140.                                 screen.setState(szString, True)
  1141.                             else:
  1142.                                 screen.setState(szString, False)
  1143.                             screen.show( szString )
  1144.                             
  1145.                             # SF CHANGE 
  1146.                             # Adds the overlay first
  1147.                             szStringIcon = szString+"Icon"
  1148.                             screen.addDDSGFC( szStringIcon, szFileName, 312 + (iCount * 34), yResolution - 172, 12, 12, WidgetTypes.WIDGET_PLOT_LIST, iCount, -1 )
  1149.                             screen.show( szStringIcon )
  1150.  
  1151.                         iCount = iCount + 1
  1152.  
  1153.             if ( iVisibleUnits > gc.getDefineINT("MAX_PLOT_LIST_SIZE") ):
  1154.                 screen.enable("PlotListMinus", bLeftArrow)
  1155.                 screen.show( "PlotListMinus" )
  1156.     
  1157.                 screen.enable("PlotListPlus", bRightArrow)
  1158.                 screen.show( "PlotListPlus" )
  1159.  
  1160.         return 0
  1161.         
  1162.     # This will update the flag widget for SP hotseat and dbeugging
  1163.     def updateFlag( self ):
  1164.  
  1165.         if ( CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_MINIMAP_ONLY ):
  1166.             screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  1167.             xResolution = screen.getXResolution()
  1168.             yResolution = screen.getYResolution()
  1169.             screen.addFlagWidgetGFC( "CivilizationFlag", ArtFileMgr.getMiscArtInfo("ART_UNITGROUP_FLAG").getKFM(), xResolution - 288, yResolution - 138, 68, 250, gc.getGame().getActivePlayer(), WidgetTypes.WIDGET_FLAG, gc.getGame().getActivePlayer(), -1)
  1170.         
  1171.     # Will hide and show the selection buttons and their associated buttons
  1172.     def updateSelectionButtons( self ):
  1173.     
  1174.         global SELECTION_BUTTON_COLUMNS
  1175.         global MAX_SELECTION_BUTTONS
  1176.         global g_pSelectedUnit
  1177.  
  1178.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  1179.         
  1180.         pHeadSelectedCity = CyInterface().getHeadSelectedCity()
  1181.         pHeadSelectedUnit = CyInterface().getHeadSelectedUnit()
  1182.         
  1183.         global g_NumEmphasizeInfos
  1184.         global g_NumCityTabTypes
  1185.         global g_NumHurryInfos
  1186.         global g_NumUnitClassInfos
  1187.         global g_NumBuildingClassInfos
  1188.         global g_NumProjectInfos
  1189.         global g_NumProcessInfos
  1190.         global g_NumActionInfos
  1191.         
  1192.         # Find out our resolution
  1193.         xResolution = screen.getXResolution()
  1194.         yResolution = screen.getYResolution()
  1195.         
  1196.         if ( CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE ):
  1197.             screen.addMultiListControlGFC( "BottomButtonContainer", u"", iMultiListXL, yResolution - 113, xResolution - (iMultiListXL+iMultiListXR), 100, 4, 48, 48, TableStyles.TABLE_STYLE_STANDARD )
  1198.         else:
  1199.             screen.addMultiListControlGFC( "BottomButtonContainer", u"", 10, yResolution - 52, xResolution - (iMultiListXR+10), 50, 4, 48, 48, TableStyles.TABLE_STYLE_STANDARD )
  1200.         screen.clearMultiList( "BottomButtonContainer" )
  1201.         screen.hide( "BottomButtonContainer" )
  1202.         
  1203.         # All of the hides...    
  1204.         self.setMinimapButtonVisibility(False)
  1205.  
  1206.         screen.hideList( 0 )
  1207.  
  1208.         if (not CyEngine().isGlobeviewUp() and pHeadSelectedCity):
  1209.         
  1210.             self.setMinimapButtonVisibility(True)
  1211.  
  1212.             if ((pHeadSelectedCity.getOwner() == gc.getGame().getActivePlayer()) or gc.getGame().isDebugMode()):
  1213.             
  1214.                 g_pSelectedUnit = 0
  1215.                 screen.show( "AutomateCitizens" )
  1216.                 screen.show( "AutomateProduction" )
  1217.                 screen.setState( "AutomateCitizens", pHeadSelectedCity.isCitizensAutomated() )
  1218.                 screen.setState( "AutomateProduction", pHeadSelectedCity.isProductionAutomated() )
  1219.                 
  1220.                 for i in range (g_NumEmphasizeInfos):
  1221.                     szButtonID = "Emphasize" + str(i)
  1222.                     screen.show( szButtonID )
  1223.                     if ( pHeadSelectedCity.AI_isEmphasize(i) ):
  1224.                         screen.setState( szButtonID, True )
  1225.                     else:
  1226.                         screen.setState( szButtonID, False )
  1227.  
  1228.                 # City Tabs
  1229.                 for i in range( g_NumCityTabTypes ):
  1230.                     szButtonID = "CityTab" + str(i)
  1231.                     screen.show( szButtonID )
  1232.  
  1233.                 # Hurry button show...
  1234.                 for i in range( g_NumHurryInfos ):
  1235.                     szButtonID = "Hurry" + str(i)
  1236.                     screen.show( szButtonID )
  1237.                     screen.enable( szButtonID, pHeadSelectedCity.canHurry(i, False) )
  1238.  
  1239.                 # Conscript Button Show
  1240.                 screen.show( "Conscript" )
  1241.                 if (pHeadSelectedCity.canConscript()):
  1242.                     screen.enable( "Conscript", True )
  1243.                 else:
  1244.                     screen.enable( "Conscript", False )
  1245.  
  1246.                 iCount = 0
  1247.  
  1248.                 # Units to construct
  1249.                 for i in range ( g_NumUnitClassInfos ):
  1250.                     eLoopUnit = gc.getCivilizationInfo(pHeadSelectedCity.getCivilizationType()).getCivilizationUnits(i)
  1251.  
  1252.                     if (pHeadSelectedCity.canTrain(eLoopUnit, False, True)):
  1253.                         screen.appendMultiListButton( "BottomButtonContainer", gc.getUnitInfo(eLoopUnit).getButton(), 0, WidgetTypes.WIDGET_TRAIN, i, -1, False )
  1254.                         screen.show( "BottomButtonContainer" )
  1255.                         
  1256.                         if ( not pHeadSelectedCity.canTrain(eLoopUnit, False, False) ):
  1257.                             screen.disableMultiListButton( "BottomButtonContainer", 0, iCount, gc.getUnitInfo(eLoopUnit).getButton() )
  1258.                         
  1259.                         iCount = iCount + 1
  1260.  
  1261.                 iCount = 0
  1262.  
  1263.                 # Buildings to construct
  1264.                 for i in range ( g_NumBuildingClassInfos ):
  1265.                     if (not isLimitedWonderClass(i)):
  1266.                         eLoopBuilding = gc.getCivilizationInfo(pHeadSelectedCity.getCivilizationType()).getCivilizationBuildings(i)
  1267.  
  1268.                         if (pHeadSelectedCity.canConstruct(eLoopBuilding, False, True, False)):
  1269.                             screen.appendMultiListButton( "BottomButtonContainer", gc.getBuildingInfo(eLoopBuilding).getButton(), 1, WidgetTypes.WIDGET_CONSTRUCT, i, -1, False )
  1270.                             screen.show( "BottomButtonContainer" )
  1271.                             
  1272.                             if ( not pHeadSelectedCity.canConstruct(eLoopBuilding, False, False, False) ):
  1273.                                 screen.disableMultiListButton( "BottomButtonContainer", 1, iCount, gc.getBuildingInfo(eLoopBuilding).getButton() )
  1274.                             
  1275.                             iCount = iCount + 1
  1276.  
  1277.                 iCount = 0
  1278.  
  1279.                 # Wonders to construct
  1280.                 i = 0
  1281.                 for i in range( g_NumBuildingClassInfos ):
  1282.                     if (isLimitedWonderClass(i)):
  1283.                         eLoopBuilding = gc.getCivilizationInfo(pHeadSelectedCity.getCivilizationType()).getCivilizationBuildings(i)
  1284.  
  1285.                         if (pHeadSelectedCity.canConstruct(eLoopBuilding, False, True, False)):
  1286.                             screen.appendMultiListButton( "BottomButtonContainer", gc.getBuildingInfo(eLoopBuilding).getButton(), 2, WidgetTypes.WIDGET_CONSTRUCT, i, -1, False )
  1287.                             screen.show( "BottomButtonContainer" )
  1288.                             
  1289.                             if ( not pHeadSelectedCity.canConstruct(eLoopBuilding, False, False, False) ):
  1290.                                 screen.disableMultiListButton( "BottomButtonContainer", 2, iCount, gc.getBuildingInfo(eLoopBuilding).getButton() )
  1291.                             
  1292.                             iCount = iCount + 1
  1293.  
  1294.                 iCount = 0
  1295.  
  1296.                 # Projects
  1297.                 i = 0
  1298.                 for i in range( g_NumProjectInfos ):
  1299.                     if (pHeadSelectedCity.canCreate(i, False, True)):
  1300.                         screen.appendMultiListButton( "BottomButtonContainer", gc.getProjectInfo(i).getButton(), 3, WidgetTypes.WIDGET_CREATE, i, -1, False )
  1301.                         screen.show( "BottomButtonContainer" )
  1302.                         
  1303.                         if ( not pHeadSelectedCity.canCreate(i, False, False) ):
  1304.                             screen.disableMultiListButton( "BottomButtonContainer", 3, iCount, gc.getProjectInfo(i).getButton() )
  1305.                         
  1306.                         iCount = iCount + 1
  1307.  
  1308.                 # Processes
  1309.                 i = 0
  1310.                 for i in range( g_NumProcessInfos ):
  1311.                     if (pHeadSelectedCity.canMaintain(i, False)):
  1312.                         screen.appendMultiListButton( "BottomButtonContainer", gc.getProcessInfo(i).getButton(), 3, WidgetTypes.WIDGET_MAINTAIN, i, -1, False )
  1313.                         screen.show( "BottomButtonContainer" )
  1314.                         
  1315.                         iCount = iCount + 1
  1316.                         
  1317.                 screen.selectMultiList( "BottomButtonContainer", CyInterface().getCityTabSelectionRow() )
  1318.                             
  1319.         elif (not CyEngine().isGlobeviewUp() and pHeadSelectedUnit and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_MINIMAP_ONLY):
  1320.  
  1321.             self.setMinimapButtonVisibility(True)
  1322.  
  1323.             if (CyInterface().getInterfaceMode() == InterfaceModeTypes.INTERFACEMODE_SELECTION):
  1324.             
  1325.                 if ( pHeadSelectedUnit.getOwner() == gc.getGame().getActivePlayer() and g_pSelectedUnit != pHeadSelectedUnit ):
  1326.                 
  1327.                     g_pSelectedUnit = pHeadSelectedUnit
  1328.                     
  1329.                     iCount = 0
  1330.  
  1331.                     actions = CyInterface().getActionsToShow()
  1332.                     for i in actions:
  1333.                         screen.appendMultiListButton( "BottomButtonContainer", gc.getActionInfo(i).getButton(), 0, WidgetTypes.WIDGET_ACTION, i, -1, False )
  1334.                         screen.show( "BottomButtonContainer" )
  1335.                 
  1336.                         if ( not CyInterface().canHandleAction(i, False) ):
  1337.                             screen.disableMultiListButton( "BottomButtonContainer", 0, iCount, gc.getActionInfo(i).getButton() )
  1338.                             
  1339.                         if ( pHeadSelectedUnit.isActionRecommended(i) ):#or gc.getActionInfo(i).getCommandType() == CommandTypes.COMMAND_PROMOTION ):
  1340.                             screen.enableMultiListPulse( "BottomButtonContainer", True, 0, iCount )
  1341.                         else:
  1342.                             screen.enableMultiListPulse( "BottomButtonContainer", False, 0, iCount )
  1343.  
  1344.                         iCount = iCount + 1
  1345.  
  1346.                     if (CyInterface().canCreateGroup()):
  1347.                         screen.appendMultiListButton( "BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTONS_CREATEGROUP").getPath(), 0, WidgetTypes.WIDGET_CREATE_GROUP, -1, -1, False )
  1348.                         screen.show( "BottomButtonContainer" )
  1349.                         
  1350.                         iCount = iCount + 1
  1351.  
  1352.                     if (CyInterface().canDeleteGroup()):
  1353.                         screen.appendMultiListButton( "BottomButtonContainer", ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTONS_SPLITGROUP").getPath(), 0, WidgetTypes.WIDGET_DELETE_GROUP, -1, -1, False )
  1354.                         screen.show( "BottomButtonContainer" )
  1355.                         
  1356.                         iCount = iCount + 1
  1357.  
  1358.         elif (CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_MINIMAP_ONLY):
  1359.         
  1360.             self.setMinimapButtonVisibility(True)
  1361.  
  1362.         return 0
  1363.         
  1364.     # Will update the research buttons
  1365.     def updateResearchButtons( self ):
  1366.     
  1367.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  1368.  
  1369.         i = 0
  1370.         for i in range( gc.getNumTechInfos() ):
  1371.             szName = "ResearchButton" + str(i)
  1372.             screen.hide( szName )
  1373.  
  1374.         # Find out our resolution
  1375.         xResolution = screen.getXResolution()
  1376.         yResolution = screen.getYResolution()
  1377.  
  1378.         #screen.hide( "InterfaceOrnamentLeftLow" )
  1379.         #screen.hide( "InterfaceOrnamentRightLow" )
  1380.             
  1381.         i = 0
  1382.         for i in range(gc.getNumReligionInfos()):
  1383.             szName = "ReligionButton" + str(i)
  1384.             screen.hide( szName )
  1385.  
  1386.         i = 0
  1387.         if ( CyInterface().shouldShowResearchButtons() and CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_SHOW ):
  1388.             iCount = 0
  1389.             
  1390.             for i in range( gc.getNumTechInfos() ):
  1391.                 if (gc.getActivePlayer().canResearch(i, False)):
  1392.                     if (iCount < 20):
  1393.                         szName = "ResearchButton" + str(i)
  1394.  
  1395.                         bDone = False
  1396.                         for j in range( gc.getNumReligionInfos() ):
  1397.                             if ( not bDone ):
  1398.                                 if (gc.getReligionInfo(j).getTechPrereq() == i):
  1399.                                     if not (gc.getGame().isReligionFounded(j)):
  1400.                                         szName = "ReligionButton" + str(j)
  1401.                                         bDone = True
  1402.  
  1403.                         screen.show( szName )
  1404.                         self.setResearchButtonPosition(szName, iCount)
  1405.  
  1406.                     iCount = iCount + 1
  1407.                     
  1408.         return 0
  1409.         
  1410.     # Will update the citizen buttons
  1411.     def updateCitizenButtons( self ):
  1412.     
  1413.         global MAX_CITIZEN_BUTTONS
  1414.         
  1415.         bHandled = False
  1416.     
  1417.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  1418.  
  1419.         # Find out our resolution
  1420.         xResolution = screen.getXResolution()
  1421.         yResolution = screen.getYResolution()
  1422.  
  1423.         for i in range( MAX_CITIZEN_BUTTONS ):
  1424.             szName = "FreeSpecialist" + str(i)
  1425.             screen.hide( szName )
  1426.             szName = "AngryCitizen" + str(i)
  1427.             screen.hide( szName )
  1428.             
  1429.         for i in range( gc.getNumSpecialistInfos() ):
  1430.             szName = "IncreaseSpecialist" + str(i)
  1431.             screen.hide( szName )
  1432.             szName = "DecreaseSpecialist" + str(i)
  1433.             screen.hide( szName )
  1434.             szName = "CitizenDisabledButton" + str(i)
  1435.             screen.hide( szName )
  1436.             for j in range(MAX_CITIZEN_BUTTONS):
  1437.                 szName = "CitizenButton" + str((i * 100) + j)
  1438.                 screen.hide( szName )
  1439.                 szName = "CitizenButtonHighlight" + str((i * 100) + j)
  1440.                 screen.hide( szName )
  1441.  
  1442.         pHeadSelectedCity = CyInterface().getHeadSelectedCity()
  1443.  
  1444.         if ( CyInterface().isCityScreenUp() ):
  1445.             if (pHeadSelectedCity and CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_SHOW):
  1446.                 if ( pHeadSelectedCity.angryPopulation(0) < MAX_CITIZEN_BUTTONS ):
  1447.                     iCount = pHeadSelectedCity.angryPopulation(0)
  1448.                 else:
  1449.                     iCount = MAX_CITIZEN_BUTTONS
  1450.  
  1451.                 for i in range(iCount):
  1452.                     bHandled = True
  1453.                     szName = "AngryCitizen" + str(i)
  1454.                     screen.show( szName )
  1455.                     
  1456.                 iCount = 0
  1457.  
  1458.                 bHandled = False
  1459.                 for i in range(gc.getNumSpecialistInfos()):
  1460.                     for j in range( pHeadSelectedCity.getFreeSpecialistCount(i) ):
  1461.                         if (iCount < MAX_CITIZEN_BUTTONS):
  1462.                             szName = "FreeSpecialist" + str(iCount)
  1463.                             screen.setImageButton( szName, gc.getSpecialistInfo(i).getTexture(), (xResolution - 74  - (34 * iCount)), yResolution - 216, 32, 32, WidgetTypes.WIDGET_CITIZEN, i, -1 )
  1464.                             screen.show( szName )
  1465.                             bHandled = true
  1466.  
  1467.                         iCount = iCount + 1
  1468.  
  1469.                 
  1470.                 for i in range( gc.getNumSpecialistInfos() ):
  1471.                 
  1472.                     bHandled = False
  1473.  
  1474.                     if ( pHeadSelectedCity.getOwner() == gc.getGame().getActivePlayer() or gc.getGame().isDebugMode() ):
  1475.                     
  1476.                         if ( pHeadSelectedCity.isSpecialistValid(i, 1) and ( pHeadSelectedCity.getForceSpecialistCount(i) < ( pHeadSelectedCity.getPopulation() - pHeadSelectedCity.angryPopulation(0) ) ) ):
  1477.                             szName = "IncreaseSpecialist" + str(i)
  1478.                             screen.show( szName )
  1479.                             szName = "CitizenDisabledButton" + str(i)
  1480.                             screen.show( szName )
  1481.  
  1482.                         if ( pHeadSelectedCity.getSpecialistCount(i) > 0 or pHeadSelectedCity.getForceSpecialistCount(i) > 0 ):
  1483.                             szName = "CitizenDisabledButton" + str(i)
  1484.                             screen.hide( szName )
  1485.                             szName = "DecreaseSpecialist" + str(i)
  1486.                             screen.show( szName )
  1487.                             
  1488.                     if ( pHeadSelectedCity.getSpecialistCount(i) < MAX_CITIZEN_BUTTONS ):
  1489.                         iCount = pHeadSelectedCity.getSpecialistCount(i)
  1490.                     else:
  1491.                         iCount = MAX_CITIZEN_BUTTONS
  1492.  
  1493.                     j = 0
  1494.                     for j in range( iCount ):
  1495.                         bHandled = True
  1496.                         szName = "CitizenButton" + str((i * 100) + j)
  1497.                         screen.addCheckBoxGFC( szName, gc.getSpecialistInfo(i).getTexture(), "", xResolution - 74 - (34 * j), (yResolution - 282 - (34 * i)), 32, 32, WidgetTypes.WIDGET_CITIZEN, i, j, ButtonStyles.BUTTON_STYLE_LABEL )
  1498.                         screen.show( szName )
  1499.                         szName = "CitizenButtonHighlight" + str((i * 100) + j)
  1500.                         screen.addDDSGFC( szName, ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(), xResolution - 74 - (34 * j), (yResolution - 282 - (34 * i)), 32, 32, WidgetTypes.WIDGET_CITIZEN, i, j )
  1501.                         if ( pHeadSelectedCity.getForceSpecialistCount(i) > j ):
  1502.                             screen.show( szName )
  1503.                         else:
  1504.                             screen.hide( szName )
  1505.                         
  1506.                     if ( not bHandled ):
  1507.                         szName = "CitizenDisabledButton" + str(i)
  1508.                         screen.show( szName )
  1509.  
  1510.         return 0
  1511.             
  1512.     # Will update the game data strings
  1513.     def updateGameDataStrings( self ):
  1514.     
  1515.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  1516.  
  1517.         screen.hide( "ResearchText" )
  1518.         screen.hide( "GoldText" )
  1519.         screen.hide( "TimeText" )
  1520.         screen.hide( "ResearchBar" )
  1521.  
  1522.         bShift = CyInterface().shiftKey()
  1523.         
  1524.         xResolution = screen.getXResolution()
  1525.         yResolution = screen.getYResolution()
  1526.  
  1527.         pHeadSelectedCity = CyInterface().getHeadSelectedCity()
  1528.  
  1529.         if (pHeadSelectedCity):
  1530.             ePlayer = pHeadSelectedCity.getOwner()
  1531.         else:
  1532.             ePlayer = gc.getGame().getActivePlayer()
  1533.  
  1534.         if ( ePlayer < 0 or ePlayer >= gc.getMAX_PLAYERS() ):
  1535.             return 0
  1536.  
  1537.         for iI in range(CommerceTypes.NUM_COMMERCE_TYPES):
  1538.             szString = "PercentText" + str(iI)
  1539.             screen.hide(szString)
  1540.  
  1541.         if ( CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_MINIMAP_ONLY ):
  1542.  
  1543.             # Percent of commerce
  1544.             if (gc.getPlayer(ePlayer).isAlive()):
  1545.                 iCount = 0
  1546.                 for iI in range( CommerceTypes.NUM_COMMERCE_TYPES ):
  1547.                     eCommerce = (iI + 1) % CommerceTypes.NUM_COMMERCE_TYPES
  1548.                     if (gc.getPlayer(ePlayer).isCommerceFlexible(eCommerce) or (CyInterface().isCityScreenUp() and (eCommerce == CommerceTypes.COMMERCE_GOLD))):
  1549.                         szOutText = u"<font=2>%c:%d%%</font>" %(gc.getCommerceInfo(eCommerce).getChar(), gc.getPlayer(ePlayer).getCommercePercent(eCommerce))
  1550.                         szString = "PercentText" + str(iI)
  1551.                         screen.setLabel( szString, "Background", szOutText, CvUtil.FONT_LEFT_JUSTIFY, 14, 50 + (iCount * 19), -0.1, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  1552.                         screen.show( szString )
  1553.  
  1554.                         iCount = iCount + 1;
  1555.                                                 
  1556.             self.updateTimeText(false)
  1557.             screen.setLabel( "TimeText", "Background", g_szTimeText, CvUtil.FONT_RIGHT_JUSTIFY, xResolution - 56, 6, -0.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  1558.             screen.show( "TimeText" )
  1559.             
  1560.             if (gc.getPlayer(ePlayer).isAlive()):
  1561.             
  1562.                 szText = CyGameTextMgr().getGoldStr(ePlayer)
  1563.                 screen.setLabel( "GoldText", "Background", szText, CvUtil.FONT_LEFT_JUSTIFY, 12, 6, -0.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  1564.                 screen.show( "GoldText" )
  1565.                 
  1566.                 if (((gc.getPlayer(ePlayer).calculateGoldRate() != 0) and not (gc.getPlayer(ePlayer).isAnarchy())) or (gc.getPlayer(ePlayer).getGold() != 0)):
  1567.                     screen.show( "GoldText" )
  1568.  
  1569.                 if (gc.getPlayer(ePlayer).isAnarchy()):
  1570.                 
  1571.                     szText = localText.getText("INTERFACE_ANARCHY", (gc.getPlayer(ePlayer).getAnarchyTurns(), ))
  1572.                     screen.setText( "ResearchText", "Background", szText, CvUtil.FONT_CENTER_JUSTIFY, screen.centerX(512), 3, -0.4, FontTypes.GAME_FONT, WidgetTypes.WIDGET_RESEARCH, -1, -1 )
  1573.                     if ( gc.getPlayer(ePlayer).getCurrentResearch() != -1 ):
  1574.                         screen.show( "ResearchText" )
  1575.                     else:
  1576.                         screen.hide( "ResearchText" )
  1577.                     
  1578.                 elif (gc.getPlayer(ePlayer).getCurrentResearch() != -1):
  1579.  
  1580.                     szText = CyGameTextMgr().getResearchStr(ePlayer)
  1581.                     screen.setText( "ResearchText", "Background", szText, CvUtil.FONT_CENTER_JUSTIFY, screen.centerX(512), 3, -0.4, FontTypes.GAME_FONT, WidgetTypes.WIDGET_RESEARCH, -1, -1 )
  1582.                     screen.show( "ResearchText" )
  1583.  
  1584.                     researchProgress = gc.getTeam(gc.getPlayer(ePlayer).getTeam()).getResearchProgress(gc.getPlayer(ePlayer).getCurrentResearch())
  1585.                     overflowResearch = gc.getPlayer(ePlayer).getOverflowResearch()
  1586.                     researchCost = gc.getTeam(gc.getPlayer(ePlayer).getTeam()).getResearchCost(gc.getPlayer(ePlayer).getCurrentResearch())
  1587.                     researchRate = gc.getPlayer(ePlayer).calculateResearchRate(-1)
  1588.                     
  1589.                     iFirst = float(researchProgress + overflowResearch) / float(researchCost)
  1590.                     screen.setBarPercentage( "ResearchBar", InfoBarTypes.INFOBAR_STORED, iFirst )
  1591.                     if ( iFirst == 1 ):
  1592.                         screen.setBarPercentage( "ResearchBar", InfoBarTypes.INFOBAR_RATE, ( float(researchRate) / float(researchCost) ) )
  1593.                     else:
  1594.                         screen.setBarPercentage( "ResearchBar", InfoBarTypes.INFOBAR_RATE, ( ( float(researchRate) / float(researchCost) ) ) / ( 1 - iFirst ) )
  1595.  
  1596.                     screen.show( "ResearchBar" )
  1597.                     
  1598.         return 0
  1599.         
  1600.     def updateTimeText( self, bUseClockText ):
  1601.         
  1602.         global g_szTimeText
  1603.         
  1604.         ePlayer = gc.getGame().getActivePlayer()
  1605.         
  1606.         if (CyUserProfile().isClockOn() and bUseClockText):
  1607.             g_szTimeText = getClockText()
  1608.         else:
  1609.             g_szTimeText = unicode(CyGameTextMgr().getInterfaceTimeStr(ePlayer))
  1610.         
  1611.     # Will update the selection Data Strings
  1612.     def updateCityScreen( self ):
  1613.     
  1614.         global MAX_DISPLAYABLE_BUILDINGS
  1615.         global MAX_DISPLAYABLE_TRADE_ROUTES
  1616.         global MAX_BONUS_ROWS
  1617.         
  1618.         global g_iNumTradeRoutes
  1619.         global g_iNumBuildings
  1620.         global g_iNumLeftBonus
  1621.         global g_iNumCenterBonus
  1622.         global g_iNumRightBonus
  1623.     
  1624.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  1625.  
  1626.         pHeadSelectedCity = CyInterface().getHeadSelectedCity()
  1627.  
  1628.         # Find out our resolution
  1629.         xResolution = screen.getXResolution()
  1630.         yResolution = screen.getYResolution()
  1631.  
  1632.         bShift = CyInterface().shiftKey()
  1633.  
  1634.         screen.hide( "PopulationBar" )
  1635.         screen.hide( "ProductionBar" )
  1636.         screen.hide( "GreatPeopleBar" )
  1637.         screen.hide( "CultureBar" )
  1638.         screen.hide( "MaintenanceText" )
  1639.         screen.hide( "MaintenanceAmountText" )
  1640.         screen.hide( "NationalityText" )
  1641.         screen.hide( "NationalityBar" )
  1642.         screen.hide( "DefenseText" )
  1643.         screen.hide( "CityScrollMinus" )
  1644.         screen.hide( "CityScrollPlus" )
  1645.         screen.hide( "CityNameText" )
  1646.         screen.hide( "PopulationText" )
  1647.         screen.hide( "PopulationInputText" )
  1648.         screen.hide( "HealthText" )
  1649.         screen.hide( "ProductionText" )
  1650.         screen.hide( "ProductionInputText" )
  1651.         screen.hide( "HappinessText" )
  1652.         screen.hide( "CultureText" )
  1653.         screen.hide( "GreatPeopleText" )
  1654.  
  1655.         for i in range( gc.getNumReligionInfos() ):
  1656.             szName = "ReligionHolyCityDDS" + str(i)
  1657.             screen.hide( szName )
  1658.             szName = "ReligionDDS" + str(i)
  1659.             screen.hide( szName )
  1660.             
  1661.         for i in range(CommerceTypes.NUM_COMMERCE_TYPES):
  1662.             szName = "CityPercentText" + str(i)
  1663.             screen.hide( szName )
  1664.  
  1665.         screen.addPanel( "BonusPane0", u"", u"", True, False, xResolution - 244, 70, 57, yResolution - 530, PanelStyles.PANEL_STYLE_CITY_COLUMNL )
  1666.         screen.hide( "BonusPane0" )
  1667.         screen.addScrollPanel( "BonusBack0", u"", xResolution - 242, 70, 157, yResolution - 546, PanelStyles.PANEL_STYLE_EXTERNAL )
  1668.         screen.hide( "BonusBack0" )
  1669.  
  1670.         screen.addPanel( "BonusPane1", u"", u"", True, False, xResolution - 187, 70, 68, yResolution - 530, PanelStyles.PANEL_STYLE_CITY_COLUMNC )
  1671.         screen.hide( "BonusPane1" )
  1672.         screen.addScrollPanel( "BonusBack1", u"", xResolution - 191, 70, 184, yResolution - 546, PanelStyles.PANEL_STYLE_EXTERNAL )
  1673.         screen.hide( "BonusBack1" )
  1674.  
  1675.         screen.addPanel( "BonusPane2", u"", u"", True, False, xResolution - 119, 70, 107, yResolution - 530, PanelStyles.PANEL_STYLE_CITY_COLUMNR )
  1676.         screen.hide( "BonusPane2" )
  1677.         screen.addScrollPanel( "BonusBack2", u"", xResolution - 125, 70, 205, yResolution - 546, PanelStyles.PANEL_STYLE_EXTERNAL )
  1678.         screen.hide( "BonusBack2" )
  1679.  
  1680.         screen.hide( "TradeRouteTable" )
  1681.         screen.hide( "BuildingListTable" )
  1682.         
  1683.         screen.hide( "BuildingListBackground" )
  1684.         screen.hide( "TradeRouteListBackground" )
  1685.         screen.hide( "BuildingListLabel" )
  1686.         screen.hide( "TradeRouteListLabel" )
  1687.  
  1688.         i = 0
  1689.         for i in range( g_iNumLeftBonus ):
  1690.             szName = "LeftBonusItem" + str(i)
  1691.             screen.hide( szName )
  1692.         
  1693.         i = 0
  1694.         for i in range( g_iNumCenterBonus ):
  1695.             szName = "CenterBonusItemLeft" + str(i)
  1696.             screen.hide( szName )
  1697.             szName = "CenterBonusItemRight" + str(i)
  1698.             screen.hide( szName )
  1699.         
  1700.         i = 0
  1701.         for i in range( g_iNumRightBonus ):
  1702.             szName = "RightBonusItemLeft" + str(i)
  1703.             screen.hide( szName )
  1704.             szName = "RightBonusItemRight" + str(i)
  1705.             screen.hide( szName )
  1706.             
  1707.         i = 0
  1708.         for i in range( 3 ):
  1709.             szName = "BonusPane" + str(i)
  1710.             screen.hide( szName )
  1711.             szName = "BonusBack" + str(i)
  1712.             screen.hide( szName )
  1713.  
  1714.         i = 0
  1715.         if ( CyInterface().isCityScreenUp() ):
  1716.             if ( pHeadSelectedCity ):
  1717.             
  1718.                 screen.show( "InterfaceTopLeftBackgroundWidget" )
  1719.                 screen.show( "InterfaceTopRightBackgroundWidget" )
  1720.                 screen.show( "InterfaceCenterLeftBackgroundWidget" )
  1721.                 screen.show( "CityScreenTopWidget" )
  1722.                 screen.show( "CityNameBackground" )
  1723.                 screen.show( "TopCityPanelLeft" )
  1724.                 screen.show( "TopCityPanelRight" )
  1725.                 screen.show( "CityScreenAdjustPanel" )
  1726.                 screen.show( "InterfaceCenterRightBackgroundWidget" )
  1727.                 
  1728.                 if ( pHeadSelectedCity.getTeam() == gc.getGame().getActiveTeam() ):
  1729.                     if ( gc.getActivePlayer().getNumCities() > 1 ):
  1730.                         screen.show( "CityScrollMinus" )
  1731.                         screen.show( "CityScrollPlus" )
  1732.                 
  1733.                 # Help Text Area
  1734.                 screen.setHelpTextArea( 390, FontTypes.SMALL_FONT, 0, 0, -2.2, True, ArtFileMgr.getInterfaceArtInfo("POPUPS_BACKGROUND_TRANSPARENT").getPath(), True, True, CvUtil.FONT_LEFT_JUSTIFY, 0 )
  1735.  
  1736.                 iFoodDifference = pHeadSelectedCity.foodDifference(True)
  1737.                 iProductionDiffNoFood = pHeadSelectedCity.getCurrentProductionDifference(True, True)
  1738.                 iProductionDiffJustFood = (pHeadSelectedCity.getCurrentProductionDifference(False, True) - iProductionDiffNoFood)
  1739.  
  1740.                 szBuffer = u"<font=4>"
  1741.                 
  1742.                 if (pHeadSelectedCity.isCapital()):
  1743.                     szBuffer += u"%c" %(CyGame().getSymbolID(FontSymbols.STAR_CHAR))
  1744.                 elif (pHeadSelectedCity.isGovernmentCenter()):
  1745.                     szBuffer += u"%c" %(CyGame().getSymbolID(FontSymbols.SILVER_STAR_CHAR))
  1746.  
  1747.                 if (pHeadSelectedCity.isPower()):
  1748.                     szBuffer += u"%c" %(CyGame().getSymbolID(FontSymbols.POWER_CHAR))
  1749.                     
  1750.                 szBuffer += u"%s: %d" %(pHeadSelectedCity.getName(), pHeadSelectedCity.getPopulation())
  1751.  
  1752.                 if (pHeadSelectedCity.isOccupation()):
  1753.                     szBuffer += u" (%c:%d)" %(CyGame().getSymbolID(FontSymbols.OCCUPATION_CHAR), pHeadSelectedCity.getOccupationTimer())
  1754.  
  1755.                 szBuffer += u"</font>"
  1756.  
  1757.                 screen.setText( "CityNameText", "Background", szBuffer, CvUtil.FONT_CENTER_JUSTIFY, screen.centerX(512), 32, -0.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_CITY_NAME, -1, -1 )
  1758.                 screen.setStyle( "CityNameText", "Button_Stone_Style" )
  1759.                 screen.show( "CityNameText" )
  1760.  
  1761.                 if ( (iFoodDifference != 0) or not (pHeadSelectedCity.isFoodProduction() ) ):
  1762.                     if (iFoodDifference > 0):
  1763.                         szBuffer = localText.getText("INTERFACE_CITY_GROWING", (pHeadSelectedCity.getFoodTurnsLeft(), ))    
  1764.                     elif (iFoodDifference < 0):
  1765.                         szBuffer = localText.getText("INTERFACE_CITY_STARVING", ())    
  1766.                     else:
  1767.                         szBuffer = localText.getText("INTERFACE_CITY_STAGNANT", ())    
  1768.  
  1769.                     screen.setLabel( "PopulationText", "Background", szBuffer, CvUtil.FONT_CENTER_JUSTIFY, screen.centerX(512), iCityCenterRow1Y, -1.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  1770.                     screen.setHitTest( "PopulationText", HitTestTypes.HITTEST_NOHIT )
  1771.                     screen.show( "PopulationText" )
  1772.  
  1773.                 if (not pHeadSelectedCity.isDisorder() and not pHeadSelectedCity.isFoodProduction()):
  1774.                 
  1775.                     szBuffer = u"%d%c - %d%c" %(pHeadSelectedCity.getYieldRate(YieldTypes.YIELD_FOOD), gc.getYieldInfo(YieldTypes.YIELD_FOOD).getChar(), pHeadSelectedCity.foodConsumption(False, 0), CyGame().getSymbolID(FontSymbols.EATEN_FOOD_CHAR))
  1776.                     screen.setLabel( "PopulationInputText", "Background", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, iCityCenterRow1X - 6, iCityCenterRow1Y, -0.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  1777.                     screen.show( "PopulationInputText" )
  1778.                     
  1779.                 else:
  1780.                 
  1781.                     szBuffer = u"%d%c" %(iFoodDifference, gc.getYieldInfo(YieldTypes.YIELD_FOOD).getChar())
  1782.                     screen.setLabel( "PopulationInputText", "Background", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, iCityCenterRow1X - 6, iCityCenterRow1Y, -0.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  1783.                     screen.show( "PopulationInputText" )
  1784.  
  1785.                 if ((pHeadSelectedCity.badHealth(False) > 0) or (pHeadSelectedCity.goodHealth() >= 0)):
  1786.                     if (pHeadSelectedCity.healthRate(False, 0) < 0):
  1787.                         szBuffer = localText.getText("INTERFACE_CITY_HEALTH_BAD", (pHeadSelectedCity.goodHealth(), pHeadSelectedCity.badHealth(False), pHeadSelectedCity.healthRate(False, 0)))
  1788.                     elif (pHeadSelectedCity.badHealth(False) > 0):
  1789.                         szBuffer = localText.getText("INTERFACE_CITY_HEALTH_GOOD", (pHeadSelectedCity.goodHealth(), pHeadSelectedCity.badHealth(False)))
  1790.                     else:
  1791.                         szBuffer = localText.getText("INTERFACE_CITY_HEALTH_GOOD_NO_BAD", (pHeadSelectedCity.goodHealth(), ))
  1792.                         
  1793.                     screen.setLabel( "HealthText", "Background", szBuffer, CvUtil.FONT_LEFT_JUSTIFY, xResolution - iCityCenterRow1X + 6, iCityCenterRow1Y, -0.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_HELP_HEALTH, -1, -1 )
  1794.                     screen.show( "HealthText" )
  1795.  
  1796.                 if (iFoodDifference < 0):
  1797.  
  1798.                     if ( pHeadSelectedCity.getFood() + iFoodDifference > 0 ):
  1799.                         iDeltaFood = pHeadSelectedCity.getFood() + iFoodDifference
  1800.                     else:
  1801.                         iDeltaFood = 0
  1802.                     if ( -iFoodDifference < pHeadSelectedCity.getFood() ):
  1803.                         iExtraFood = -iFoodDifference
  1804.                     else:
  1805.                         iExtraFood = pHeadSelectedCity.getFood()
  1806.                     iFirst = float(iDeltaFood) / float(pHeadSelectedCity.growthThreshold())
  1807.                     screen.setBarPercentage( "PopulationBar", InfoBarTypes.INFOBAR_STORED, iFirst )
  1808.                     screen.setBarPercentage( "PopulationBar", InfoBarTypes.INFOBAR_RATE, 0.0 )
  1809.                     if ( iFirst == 1 ):
  1810.                         screen.setBarPercentage( "PopulationBar", InfoBarTypes.INFOBAR_RATE_EXTRA, ( float(iExtraFood) / float(pHeadSelectedCity.growthThreshold()) ) )
  1811.                     else:
  1812.                         screen.setBarPercentage( "PopulationBar", InfoBarTypes.INFOBAR_RATE_EXTRA, ( ( float(iExtraFood) / float(pHeadSelectedCity.growthThreshold()) ) ) / ( 1 - iFirst ) )
  1813.                     
  1814.                 else:
  1815.  
  1816.                     iFirst = float(pHeadSelectedCity.getFood()) / float(pHeadSelectedCity.growthThreshold())
  1817.                     screen.setBarPercentage( "PopulationBar", InfoBarTypes.INFOBAR_STORED, iFirst )
  1818.                     if ( iFirst == 1 ):
  1819.                         screen.setBarPercentage( "PopulationBar", InfoBarTypes.INFOBAR_RATE, ( float(iFoodDifference) / float(pHeadSelectedCity.growthThreshold()) ) )
  1820.                     else:
  1821.                         screen.setBarPercentage( "PopulationBar", InfoBarTypes.INFOBAR_RATE, ( ( float(iFoodDifference) / float(pHeadSelectedCity.growthThreshold()) ) ) / ( 1 - iFirst ) )
  1822.                     screen.setBarPercentage( "PopulationBar", InfoBarTypes.INFOBAR_RATE_EXTRA, 0.0 )
  1823.                     
  1824.                 screen.show( "PopulationBar" )
  1825.  
  1826.                 if (pHeadSelectedCity.getOrderQueueLength() > 0):
  1827.                     if (pHeadSelectedCity.isProductionProcess()):
  1828.                         szBuffer = pHeadSelectedCity.getProductionName()
  1829.                     else:
  1830.                         szBuffer = localText.getText("INTERFACE_CITY_PRODUCTION", (pHeadSelectedCity.getProductionNameKey(), pHeadSelectedCity.getProductionTurnsLeft()))
  1831.  
  1832.                     screen.setLabel( "ProductionText", "Background", szBuffer, CvUtil.FONT_CENTER_JUSTIFY, screen.centerX(512), iCityCenterRow2Y, -1.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  1833.                     screen.setHitTest( "ProductionText", HitTestTypes.HITTEST_NOHIT )
  1834.                     screen.show( "ProductionText" )
  1835.                 
  1836.                 if (pHeadSelectedCity.isProductionProcess()):
  1837.                     szBuffer = u"%d%c" %(pHeadSelectedCity.getBaseYieldRate(YieldTypes.YIELD_PRODUCTION), gc.getYieldInfo(YieldTypes.YIELD_PRODUCTION).getChar())
  1838.                 elif (pHeadSelectedCity.isFoodProduction() and (iProductionDiffJustFood > 0)):
  1839.                     szBuffer = u"%d%c + %d%c" %(iProductionDiffJustFood, gc.getYieldInfo(YieldTypes.YIELD_FOOD).getChar(), iProductionDiffNoFood, gc.getYieldInfo(YieldTypes.YIELD_PRODUCTION).getChar())
  1840.                 else:
  1841.                     szBuffer = u"%d%c" %(iProductionDiffNoFood, gc.getYieldInfo(YieldTypes.YIELD_PRODUCTION).getChar())
  1842.                     
  1843.                 screen.setLabel( "ProductionInputText", "Background", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, iCityCenterRow1X - 6, iCityCenterRow2Y, -0.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_PRODUCTION_MOD_HELP, -1, -1 )
  1844.                 screen.show( "ProductionInputText" )
  1845.  
  1846.                 if ((pHeadSelectedCity.happyLevel() >= 0) or (pHeadSelectedCity.unhappyLevel(0) > 0)):
  1847.                     if (pHeadSelectedCity.isDisorder()):
  1848.                         szBuffer = u"%d%c" %(pHeadSelectedCity.angryPopulation(0), CyGame().getSymbolID(FontSymbols.ANGRY_POP_CHAR))
  1849.                     elif (pHeadSelectedCity.angryPopulation(0) > 0):
  1850.                         szBuffer = localText.getText("INTERFACE_CITY_UNHAPPY", (pHeadSelectedCity.happyLevel(), pHeadSelectedCity.unhappyLevel(0), pHeadSelectedCity.angryPopulation(0)))
  1851.                     elif (pHeadSelectedCity.unhappyLevel(0) > 0):
  1852.                         szBuffer = localText.getText("INTERFACE_CITY_HAPPY", (pHeadSelectedCity.happyLevel(), pHeadSelectedCity.unhappyLevel(0)))
  1853.                     else:
  1854.                         szBuffer = localText.getText("INTERFACE_CITY_HAPPY_NO_UNHAPPY", (pHeadSelectedCity.happyLevel(), ))
  1855.  
  1856.                     screen.setLabel( "HappinessText", "Background", szBuffer, CvUtil.FONT_LEFT_JUSTIFY, xResolution - iCityCenterRow1X + 6, iCityCenterRow2Y, -0.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_HELP_HAPPINESS, -1, -1 )
  1857.                     screen.show( "HappinessText" )
  1858.  
  1859.                 if (not(pHeadSelectedCity.isProductionProcess())):
  1860.                 
  1861.                     iFirst = ((float(pHeadSelectedCity.getProduction())) / (float(pHeadSelectedCity.getProductionNeeded())))
  1862.                     screen.setBarPercentage( "ProductionBar", InfoBarTypes.INFOBAR_STORED, iFirst )
  1863.                     if ( iFirst == 1 ):
  1864.                         iSecond = ( ((float(iProductionDiffNoFood)) / (float(pHeadSelectedCity.getProductionNeeded()))) )
  1865.                     else:
  1866.                         iSecond = ( ((float(iProductionDiffNoFood)) / (float(pHeadSelectedCity.getProductionNeeded()))) ) / ( 1 - iFirst )
  1867.                     screen.setBarPercentage( "ProductionBar", InfoBarTypes.INFOBAR_RATE, iSecond )
  1868.                     if ( iFirst + iSecond == 1 ):
  1869.                         screen.setBarPercentage( "ProductionBar", InfoBarTypes.INFOBAR_RATE_EXTRA, ( ((float(iProductionDiffJustFood)) / (float(pHeadSelectedCity.getProductionNeeded()))) ) )
  1870.                     else:
  1871.                         screen.setBarPercentage( "ProductionBar", InfoBarTypes.INFOBAR_RATE_EXTRA, ( ( ((float(iProductionDiffJustFood)) / (float(pHeadSelectedCity.getProductionNeeded()))) ) ) / ( 1 - ( iFirst + iSecond ) ) )
  1872.  
  1873.                     screen.show( "ProductionBar" )
  1874.  
  1875.                 iCount = 0
  1876.  
  1877.                 for i in range(CommerceTypes.NUM_COMMERCE_TYPES):
  1878.                     eCommerce = (i + 1) % CommerceTypes.NUM_COMMERCE_TYPES
  1879.  
  1880.                     if ((gc.getPlayer(pHeadSelectedCity.getOwner()).isCommerceFlexible(eCommerce)) or (eCommerce == CommerceTypes.COMMERCE_GOLD)):
  1881.                         szBuffer = u"%d%c" %(pHeadSelectedCity.getCommerceRate(eCommerce), gc.getCommerceInfo(eCommerce).getChar())
  1882.  
  1883.                         iHappiness = pHeadSelectedCity.getCommerceHappinessByType(eCommerce)
  1884.  
  1885.                         if (iHappiness != 0):
  1886.                             if ( iHappiness > 0 ):
  1887.                                 szTempBuffer = u", %d%c" %(iHappiness, CyGame().getSymbolID(FontSymbols.HAPPY_CHAR))
  1888.                             else:
  1889.                                 szTempBuffer = u", %d%c" %(-iHappiness, CyGame().getSymbolID(FontSymbols.UNHAPPY_CHAR))
  1890.                             szBuffer = szBuffer + szTempBuffer
  1891.  
  1892.                         szName = "CityPercentText" + str(iCount)
  1893.                         screen.setLabel( szName, "Background", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, 220, 45 + (19 * iCount) + 4, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_COMMERCE_MOD_HELP, eCommerce, -1 )
  1894.                         screen.show( szName )
  1895.                         iCount = iCount + 1
  1896.  
  1897.                 iCount = 0
  1898.  
  1899.                 screen.addTableControlGFC( "TradeRouteTable", 3, 10, 168, 238, 98, False, False, 32, 32, TableStyles.TABLE_STYLE_STANDARD )
  1900.                 screen.setStyle( "TradeRouteTable", "Table_City_Style" )
  1901.                 screen.addTableControlGFC( "BuildingListTable", 3, 10, 298, 238, yResolution - 522, False, False, 32, 32, TableStyles.TABLE_STYLE_STANDARD )
  1902.                 screen.setStyle( "BuildingListTable", "Table_City_Style" )
  1903.                 
  1904.                 screen.setTableColumnHeader( "TradeRouteTable", 0, u"", 108 )
  1905.                 screen.setTableColumnHeader( "TradeRouteTable", 1, u"", 118 )
  1906.                 screen.setTableColumnHeader( "TradeRouteTable", 2, u"", 10 )
  1907.                 screen.setTableColumnRightJustify( "TradeRouteTable", 1 )
  1908.  
  1909.                 screen.setTableColumnHeader( "BuildingListTable", 0, u"", 108 )
  1910.                 screen.setTableColumnHeader( "BuildingListTable", 1, u"", 118 )
  1911.                 screen.setTableColumnHeader( "BuildingListTable", 2, u"", 10 )
  1912.                 screen.setTableColumnRightJustify( "BuildingListTable", 1 )
  1913.  
  1914.                 screen.show( "BuildingListBackground" )
  1915.                 screen.show( "TradeRouteListBackground" )
  1916.                 screen.show( "BuildingListLabel" )
  1917.                 screen.show( "TradeRouteListLabel" )
  1918.                 
  1919.                 for i in range( 3 ):
  1920.                     szName = "BonusPane" + str(i)
  1921.                     screen.show( szName )
  1922.                     szName = "BonusBack" + str(i)
  1923.                     screen.show( szName )
  1924.  
  1925.                 i = 0
  1926.                 iNumBuildings = 0
  1927.                 for i in range( gc.getNumBuildingInfos() ):
  1928.                     if (pHeadSelectedCity.hasBuilding(i)):
  1929.                         szLeftBuffer = gc.getBuildingInfo(i).getDescription()
  1930.                         szRightBuffer = u""
  1931.                         bFirst = True
  1932.  
  1933.                         if (pHeadSelectedCity.hasActiveBuilding(i)):
  1934.                             iHealth = pHeadSelectedCity.getBuildingHealth(i)
  1935.  
  1936.                             if (iHealth != 0):
  1937.                                 if ( bFirst == False ):
  1938.                                     szRightBuffer = szRightBuffer + ", "
  1939.                                 else:
  1940.                                     bFirst = False
  1941.                                     
  1942.                                 if ( iHealth > 0 ):
  1943.                                     szTempBuffer = u"+%d%c" %( iHealth, CyGame().getSymbolID(FontSymbols.HEALTHY_CHAR) )
  1944.                                     szRightBuffer = szRightBuffer + szTempBuffer
  1945.                                 else:
  1946.                                     szTempBuffer = u"+%d%c" %( -(iHealth), CyGame().getSymbolID(FontSymbols.UNHEALTHY_CHAR) )
  1947.                                     szRightBuffer = szRightBuffer + szTempBuffer
  1948.  
  1949.                             iHappiness = pHeadSelectedCity.getBuildingHappiness(i)
  1950.  
  1951.                             if (iHappiness != 0):
  1952.                                 if ( bFirst == False ):
  1953.                                     szRightBuffer = szRightBuffer + ", "
  1954.                                 else:
  1955.                                     bFirst = False
  1956.                                     
  1957.                                 if ( iHappiness > 0 ):
  1958.                                     szTempBuffer = u"+%d%c" %(iHappiness, CyGame().getSymbolID(FontSymbols.HAPPY_CHAR) )
  1959.                                     szRightBuffer = szRightBuffer + szTempBuffer
  1960.                                 else:
  1961.                                     szTempBuffer = u"+%d%c" %( -(iHappiness), CyGame().getSymbolID(FontSymbols.UNHAPPY_CHAR) )
  1962.                                     szRightBuffer = szRightBuffer + szTempBuffer
  1963.  
  1964.                             for j in range( YieldTypes.NUM_YIELD_TYPES):
  1965.                                 iYield = gc.getBuildingInfo(i).getYieldChange(j)
  1966.  
  1967.                                 if (iYield != 0):
  1968.                                     if ( bFirst == False ):
  1969.                                         szRightBuffer = szRightBuffer + ", "
  1970.                                     else:
  1971.                                         bFirst = False
  1972.                                         
  1973.                                     if ( iYield > 0 ):
  1974.                                         szTempBuffer = u"%s%d%c" %( "+", iYield, gc.getYieldInfo(j).getChar() )
  1975.                                         szRightBuffer = szRightBuffer + szTempBuffer
  1976.                                     else:
  1977.                                         szTempBuffer = u"%s%d%c" %( "", iYield, gc.getYieldInfo(j).getChar() )
  1978.                                         szRightBuffer = szRightBuffer + szTempBuffer
  1979.  
  1980.                         for j in range(CommerceTypes.NUM_COMMERCE_TYPES):
  1981.                             iCommerce = pHeadSelectedCity.getBuildingCommerceByBuilding(j, i)
  1982.  
  1983.                             if (iCommerce != 0):
  1984.                                 if ( bFirst == False ):
  1985.                                     szRightBuffer = szRightBuffer + ", "
  1986.                                 else:
  1987.                                     bFirst = False
  1988.                                     
  1989.                                 if ( iCommerce > 0 ):
  1990.                                     szTempBuffer = u"%s%d%c" %( "+", iCommerce, gc.getCommerceInfo(j).getChar() )
  1991.                                     szRightBuffer = szRightBuffer + szTempBuffer
  1992.                                 else:
  1993.                                     szTempBuffer = u"%s%d%c" %( "", iCommerce, gc.getCommerceInfo(j).getChar() )
  1994.                                     szRightBuffer = szRightBuffer + szTempBuffer
  1995.  
  1996.                         szBuffer = szLeftBuffer + "  " + szRightBuffer
  1997.                         
  1998.                         screen.appendTableRow( "BuildingListTable" )
  1999.                         screen.setTableText( "BuildingListTable", 0, iNumBuildings, "<font=1>" + szLeftBuffer + "</font>", "", WidgetTypes.WIDGET_HELP_BUILDING, i, -1, CvUtil.FONT_LEFT_JUSTIFY )
  2000.                         screen.setTableText( "BuildingListTable", 1, iNumBuildings, "<font=1>" + szRightBuffer + "</font>", "", WidgetTypes.WIDGET_HELP_BUILDING, i, -1, CvUtil.FONT_RIGHT_JUSTIFY )
  2001.                         
  2002.                         iNumBuildings = iNumBuildings + 1
  2003.                         
  2004.                 if ( iNumBuildings > g_iNumBuildings ):
  2005.                     g_iNumBuildings = iNumBuildings
  2006.                     
  2007.                 iNumTradeRoutes = 0
  2008.                 
  2009.                 for i in range(gc.getDefineINT("MAX_TRADE_ROUTES")):
  2010.                     pLoopCity = pHeadSelectedCity.getTradeCity(i)
  2011.   
  2012.                     if (pLoopCity and pLoopCity.getOwner() >= 0):
  2013.                         player = gc.getPlayer(pLoopCity.getOwner())
  2014.                         szLeftBuffer = u"<color=%d,%d,%d,%d>%s</color>" %(player.getPlayerTextColorR(), player.getPlayerTextColorG(), player.getPlayerTextColorB(), player.getPlayerTextColorA(), pLoopCity.getName() )
  2015.                         szRightBuffer = u""
  2016.  
  2017.                         for j in range( YieldTypes.NUM_YIELD_TYPES ):
  2018.                             iTradeProfit = pHeadSelectedCity.calculateTradeYield(j, pHeadSelectedCity.calculateTradeProfit(pLoopCity))
  2019.  
  2020.                             if (iTradeProfit != 0):
  2021.                                 if ( iTradeProfit > 0 ):
  2022.                                     szTempBuffer = u"%s%d%c" %( "+", iTradeProfit, gc.getYieldInfo(j).getChar() )
  2023.                                     szRightBuffer = szRightBuffer + szTempBuffer
  2024.                                 else:
  2025.                                     szTempBuffer = u"%s%d%c" %( "", iTradeProfit, gc.getYieldInfo(j).getChar() )
  2026.                                     szRightBuffer = szRightBuffer + szTempBuffer
  2027.  
  2028.                         screen.appendTableRow( "TradeRouteTable" )
  2029.                         screen.setTableText( "TradeRouteTable", 0, iNumTradeRoutes, "<font=1>" + szLeftBuffer + "</font>", "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_LEFT_JUSTIFY )
  2030.                         screen.setTableText( "TradeRouteTable", 1, iNumTradeRoutes, "<font=1>" + szRightBuffer + "</font>", "", WidgetTypes.WIDGET_GENERAL, -1, -1, CvUtil.FONT_RIGHT_JUSTIFY )
  2031.                         
  2032.                         iNumTradeRoutes = iNumTradeRoutes + 1
  2033.                         
  2034.                 if ( iNumTradeRoutes > g_iNumTradeRoutes ):
  2035.                     g_iNumTradeRoutes = iNumTradeRoutes
  2036.  
  2037.                 i = 0  
  2038.                 iLeftCount = 0
  2039.                 iCenterCount = 0
  2040.                 iRightCount = 0
  2041.  
  2042.                 for i in range( gc.getNumBonusInfos() ):
  2043.                     bHandled = False
  2044.                     if ( pHeadSelectedCity.hasBonus(i) ):
  2045.  
  2046.                         iHealth = pHeadSelectedCity.getBonusHealth(i)
  2047.                         iHappiness = pHeadSelectedCity.getBonusHappiness(i)
  2048.                         
  2049.                         szBuffer = u""
  2050.                         szLeadBuffer = u""
  2051.  
  2052.                         szTempBuffer = u"<font=1>%c" %( gc.getBonusInfo(i).getChar() )
  2053.                         szLeadBuffer = szLeadBuffer + szTempBuffer
  2054.                         
  2055.                         if (pHeadSelectedCity.getNumBonuses(i) > 1):
  2056.                             szTempBuffer = u"(%d)" %( pHeadSelectedCity.getNumBonuses(i) )
  2057.                             szLeadBuffer = szLeadBuffer + szTempBuffer
  2058.  
  2059.                         szLeadBuffer = szLeadBuffer + "</font>"
  2060.                         
  2061.                         if (iHappiness != 0):
  2062.                             if ( iHappiness > 0 ):
  2063.                                 szTempBuffer = u"<font=1>+%d%c</font>" %(iHappiness, CyGame().getSymbolID(FontSymbols.HAPPY_CHAR) )
  2064.                             else:
  2065.                                 szTempBuffer = u"<font=1>-%d%c</font>" %( iHappiness, CyGame().getSymbolID(FontSymbols.UNHAPPY_CHAR) )
  2066.  
  2067.                             if ( iHealth > 0 ):
  2068.                                 szTempBuffer += u"<font=1>, +%d%c</font>" %( iHealth, CyGame().getSymbolID( FontSymbols.HEALTHY_CHAR ) )
  2069.  
  2070.                             szName = "RightBonusItemLeft" + str(iRightCount)
  2071.                             screen.setLabelAt( szName, "BonusBack2", szLeadBuffer, CvUtil.FONT_LEFT_JUSTIFY, 0, (iRightCount * 20) + 4, -0.1, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, i, -1 )
  2072.                             szName = "RightBonusItemRight" + str(iRightCount)
  2073.                             screen.setLabelAt( szName, "BonusBack2", szTempBuffer, CvUtil.FONT_RIGHT_JUSTIFY, 102, (iRightCount * 20) + 4, -0.1, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, i, -1 )
  2074.                             
  2075.                             iRightCount = iRightCount + 1
  2076.  
  2077.                             bHandled = True
  2078.  
  2079.                         if (iHealth != 0 and bHandled == False):
  2080.                             if ( iHealth > 0 ):
  2081.                                 szTempBuffer = u"<font=1>+%d%c</font>" %( iHealth, CyGame().getSymbolID( FontSymbols.HEALTHY_CHAR ) )
  2082.                             else:
  2083.                                 szTempBuffer = u"<font=1>-%d%c</font>" %( iHealth, CyGame().getSymbolID(FontSymbols.UNHEALTHY_CHAR) )
  2084.                                 
  2085.                             szName = "CenterBonusItemLeft" + str(iCenterCount)
  2086.                             screen.setLabelAt( szName, "BonusBack1", szLeadBuffer, CvUtil.FONT_LEFT_JUSTIFY, 0, (iCenterCount * 20) + 4, -0.1, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, i, -1 )
  2087.                             szName = "CenterBonusItemRight" + str(iCenterCount)
  2088.                             screen.setLabelAt( szName, "BonusBack1", szTempBuffer, CvUtil.FONT_RIGHT_JUSTIFY, 62, (iCenterCount * 20) + 4, -0.1, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, i, -1 )
  2089.                             
  2090.                             iCenterCount = iCenterCount + 1
  2091.  
  2092.                             bHandled = True
  2093.  
  2094.                         szBuffer = u""
  2095.                         if ( not bHandled ):
  2096.                         
  2097.                             szName = "LeftBonusItem" + str(iLeftCount)
  2098.                             screen.setLabelAt( szName, "BonusBack0", szLeadBuffer, CvUtil.FONT_LEFT_JUSTIFY, 0, (iLeftCount * 20) + 4, -0.1, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BONUS, i, -1 )
  2099.                             
  2100.                             iLeftCount = iLeftCount + 1
  2101.  
  2102.                             bHandled = True
  2103.  
  2104.                 g_iNumLeftBonus = iLeftCount
  2105.                 g_iNumCenterBonus = iCenterCount
  2106.                 g_iNumRightBonus = iRightCount
  2107.                 
  2108.                 iMaintenance = pHeadSelectedCity.getMaintenance()
  2109.  
  2110.                 szBuffer = localText.getText("INTERFACE_CITY_MAINTENANCE", ())
  2111.                 
  2112.                 screen.setLabel( "MaintenanceText", "Background", szBuffer, CvUtil.FONT_LEFT_JUSTIFY, 15, 107, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_HELP_MAINTENANCE, -1, -1 )
  2113.                 screen.show( "MaintenanceText" )
  2114.                 
  2115.                 szBuffer = u"%d%c" %(-(pHeadSelectedCity.getMaintenance()), gc.getCommerceInfo(CommerceTypes.COMMERCE_GOLD).getChar())
  2116.                 screen.setLabel( "MaintenanceAmountText", "Background", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, 220, 106, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_HELP_MAINTENANCE, -1, -1 )
  2117.                 screen.show( "MaintenanceAmountText" )
  2118.  
  2119.                 szBuffer = u""
  2120.  
  2121.                 i = 0
  2122.                 for i in range(gc.getNumReligionInfos()):
  2123.                     xCoord = xResolution - 242 + (i * 34)
  2124.                     yCoord = 42
  2125.                     
  2126.                     bEnable = True
  2127.                         
  2128.                     if (pHeadSelectedCity.isHasReligion(i)):
  2129.                         if (pHeadSelectedCity.isHolyCityByType(i)):
  2130.                             szTempBuffer = u"%c" %(gc.getReligionInfo(i).getHolyCityChar())
  2131.                             szName = "ReligionHolyCityDDS" + str(i)
  2132.                             screen.show( szName )
  2133.                         else:
  2134.                             szTempBuffer = u"%c" %(gc.getReligionInfo(i).getChar())
  2135.                         szBuffer = szBuffer + szTempBuffer
  2136.  
  2137.                         j = 0
  2138.                         for j in range(CommerceTypes.NUM_COMMERCE_TYPES):
  2139.                             iCommerce = pHeadSelectedCity.getReligionCommerceByReligion(j, i)
  2140.  
  2141.                             if (iCommerce != 0):
  2142.                                 if ( iCommerce > 0 ):
  2143.                                     szTempBuffer = u",%s%d%c" %("+", iCommerce, gc.getCommerceInfo(j).getChar() )
  2144.                                     szBuffer = szBuffer + szTempBuffer
  2145.                                 else:
  2146.                                     szTempBuffer = u",%s%d%c" %( "", iCommerce, gc.getCommerceInfo(j).getChar() )
  2147.                                     szBuffer = szBuffer + szTempBuffer
  2148.  
  2149.                         iHappiness = pHeadSelectedCity.getReligionHappiness(i)
  2150.  
  2151.                         if (iHappiness != 0):
  2152.                             if ( iHappiness > 0 ):
  2153.                                 szTempBuffer = u",+%d%c" %(iHappiness, CyGame().getSymbolID(FontSymbols.HAPPY_CHAR) )
  2154.                                 szBuffer = szBuffer + szTempBuffer
  2155.                             else:
  2156.                                 szTempBuffer = u",+%d%c" %(-(iHappiness), CyGame().getSymbolID(FontSymbols.UNHAPPY_CHAR) )
  2157.                                 szBuffer = szBuffer + szTempBuffer
  2158.  
  2159.                         szBuffer = szBuffer + " "
  2160.                         
  2161.                         szButton = gc.getReligionInfo(i).getButton()
  2162.                     
  2163.                     else:
  2164.                     
  2165.                         bEnable = False
  2166.                         szButton = gc.getReligionInfo(i).getButton()
  2167.  
  2168.                     szName = "ReligionDDS" + str(i)
  2169.                     screen.setImageButton( szName, szButton, xCoord, yCoord, 24, 24, WidgetTypes.WIDGET_HELP_RELIGION_CITY, i, -1 )
  2170.                     screen.enable( szName, bEnable )
  2171.                     screen.show( szName )
  2172.  
  2173.                 szBuffer = u"%d%% %s" %(pHeadSelectedCity.plot().calculateCulturePercent(pHeadSelectedCity.getOwner()), gc.getPlayer(pHeadSelectedCity.getOwner()).getCivilizationAdjective(0) )
  2174.                 screen.setLabel( "NationalityText", "Background", szBuffer, CvUtil.FONT_CENTER_JUSTIFY, 125, yResolution - 210, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  2175.                 screen.setHitTest( "NationalityText", HitTestTypes.HITTEST_NOHIT )
  2176.                 screen.show( "NationalityText" )
  2177.                 iRemainder = 0
  2178.                 iWhichBar = 0
  2179.                 for h in range( gc.getMAX_CIV_PLAYERS() ):
  2180.                     if ( gc.getPlayer(h).isAlive() ):
  2181.                         fPercent = pHeadSelectedCity.plot().calculateCulturePercent(h)
  2182.                         fPercent = fPercent / 100.0
  2183.                         if ( fPercent != 0 ):
  2184.                             screen.setStackedBarColorsRGB( "NationalityBar", iWhichBar, gc.getPlayer(h).getPlayerTextColorR(), gc.getPlayer(h).getPlayerTextColorG(), gc.getPlayer(h).getPlayerTextColorB(), gc.getPlayer(h).getPlayerTextColorA() )
  2185.                             if ( iRemainder == 1 ):
  2186.                                 screen.setBarPercentage( "NationalityBar", iWhichBar, fPercent )
  2187.                             else:
  2188.                                 screen.setBarPercentage( "NationalityBar", iWhichBar, fPercent / ( 1 - iRemainder ) )
  2189.                             iRemainder += fPercent
  2190.                             iWhichBar += 1
  2191.                 screen.show( "NationalityBar" )
  2192.  
  2193.                 iDefenseModifier = pHeadSelectedCity.getVisibleDefenseModifier()
  2194.  
  2195.                 if (iDefenseModifier != 0):
  2196.                     if (iDefenseModifier > 0):
  2197.                         szBuffer = u"%c Defense: %s%d%%" %(CyGame().getSymbolID(FontSymbols.DEFENSE_CHAR), "+", iDefenseModifier)
  2198.                     else:
  2199.                         szBuffer = u"%c Defense: %d%%" %(CyGame().getSymbolID(FontSymbols.DEFENSE_CHAR), iDefenseModifier)
  2200.                     
  2201.                     if (pHeadSelectedCity.getDefenseDamage() > 0):
  2202.                         szTempBuffer = u" (%d%%)" %( ( ( gc.getMAX_CITY_DEFENSE_DAMAGE() - pHeadSelectedCity.getDefenseDamage() ) * 100 ) / gc.getMAX_CITY_DEFENSE_DAMAGE() )
  2203.                         szBuffer = szBuffer + szTempBuffer
  2204.                     szNewBuffer = "<font=4>"
  2205.                     szNewBuffer = szNewBuffer + szBuffer
  2206.                     szNewBuffer = szNewBuffer + "</font>"
  2207.                     screen.setLabel( "DefenseText", "Background", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, xResolution - 270, 40, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_HELP_DEFENSE, -1, -1 )
  2208.                     screen.show( "DefenseText" )
  2209.  
  2210.                 if ( pHeadSelectedCity.getCultureLevel != CultureLevelTypes.NO_CULTURELEVEL ):
  2211.                     szBuffer = localText.getText("INTERFACE_CITY_COMMERCE_RATE", (gc.getCommerceInfo(CommerceTypes.COMMERCE_CULTURE).getChar(), gc.getCultureLevelInfo(pHeadSelectedCity.getCultureLevel()).getTextKey(), pHeadSelectedCity.getCommerceRate(CommerceTypes.COMMERCE_CULTURE)))
  2212.                     screen.setLabel( "CultureText", "Background", szBuffer, CvUtil.FONT_CENTER_JUSTIFY, 125, yResolution - 184, -1.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  2213.                     screen.setHitTest( "CultureText", HitTestTypes.HITTEST_NOHIT )
  2214.                     screen.show( "CultureText" )
  2215.  
  2216.                 if ((pHeadSelectedCity.getGreatPeopleProgress() > 0) or (pHeadSelectedCity.getGreatPeopleRate() > 0)):
  2217.                     szBuffer = localText.getText("INTERFACE_CITY_GREATPEOPLE_RATE", (CyGame().getSymbolID(FontSymbols.GREAT_PEOPLE_CHAR), pHeadSelectedCity.getGreatPeopleRate()))
  2218.  
  2219.                     screen.setLabel( "GreatPeopleText", "Background", szBuffer, CvUtil.FONT_CENTER_JUSTIFY, xResolution - 146, yResolution - 176, -1.3, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  2220.                     screen.setHitTest( "GreatPeopleText", HitTestTypes.HITTEST_NOHIT )
  2221.                     screen.show( "GreatPeopleText" )
  2222.  
  2223.                     iFirst = float(pHeadSelectedCity.getGreatPeopleProgress()) / float( gc.getPlayer( pHeadSelectedCity.getOwner() ).greatPeopleThreshold() )
  2224.                     screen.setBarPercentage( "GreatPeopleBar", InfoBarTypes.INFOBAR_STORED, iFirst )
  2225.                     if ( iFirst == 1 ):
  2226.                         screen.setBarPercentage( "GreatPeopleBar", InfoBarTypes.INFOBAR_RATE, ( float(pHeadSelectedCity.getGreatPeopleRate()) / float( gc.getPlayer( pHeadSelectedCity.getOwner() ).greatPeopleThreshold() ) ) )
  2227.                     else:
  2228.                         screen.setBarPercentage( "GreatPeopleBar", InfoBarTypes.INFOBAR_RATE, ( ( float(pHeadSelectedCity.getGreatPeopleRate()) / float( gc.getPlayer( pHeadSelectedCity.getOwner() ).greatPeopleThreshold() ) ) ) / ( 1 - iFirst ) )
  2229.                     screen.show( "GreatPeopleBar" )
  2230.  
  2231.                 iFirst = float(pHeadSelectedCity.getCulture(pHeadSelectedCity.getOwner())) / float(pHeadSelectedCity.getCultureThreshold())
  2232.                 screen.setBarPercentage( "CultureBar", InfoBarTypes.INFOBAR_STORED, iFirst )
  2233.                 if ( iFirst == 1 ):
  2234.                     screen.setBarPercentage( "CultureBar", InfoBarTypes.INFOBAR_RATE, ( float(pHeadSelectedCity.getCommerceRate(CommerceTypes.COMMERCE_CULTURE)) / float(pHeadSelectedCity.getCultureThreshold()) ) )
  2235.                 else:
  2236.                     screen.setBarPercentage( "CultureBar", InfoBarTypes.INFOBAR_RATE, ( ( float(pHeadSelectedCity.getCommerceRate(CommerceTypes.COMMERCE_CULTURE)) / float(pHeadSelectedCity.getCultureThreshold()) ) ) / ( 1 - iFirst ) )
  2237.                 screen.show( "CultureBar" )
  2238.                 
  2239.         else:
  2240.         
  2241.             # Help Text Area
  2242.             if ( CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_SHOW ):
  2243.                 screen.setHelpTextArea( 350, FontTypes.SMALL_FONT, 7, yResolution - 172, -0.1, False, "", True, False, CvUtil.FONT_LEFT_JUSTIFY, 150 )
  2244.             else:
  2245.                 screen.setHelpTextArea( 350, FontTypes.SMALL_FONT, 7, yResolution - 50, -0.1, False, "", True, False, CvUtil.FONT_LEFT_JUSTIFY, 150 )
  2246.  
  2247.             screen.hide( "InterfaceTopLeftBackgroundWidget" )
  2248.             screen.hide( "InterfaceTopRightBackgroundWidget" )
  2249.             screen.hide( "InterfaceCenterLeftBackgroundWidget" )
  2250.             screen.hide( "CityScreenTopWidget" )
  2251.             screen.hide( "CityNameBackground" )
  2252.             screen.hide( "TopCityPanelLeft" )
  2253.             screen.hide( "TopCityPanelRight" )
  2254.             screen.hide( "CityScreenAdjustPanel" )
  2255.             screen.hide( "InterfaceCenterRightBackgroundWidget" )
  2256.             
  2257.             if ( CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_SHOW ):
  2258.                 self.setMinimapButtonVisibility(True)
  2259.  
  2260.         return 0
  2261.         
  2262.     # Will update the info pane strings
  2263.     def updateInfoPaneStrings( self ):
  2264.     
  2265.         iRow = 0
  2266.     
  2267.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  2268.  
  2269.         pHeadSelectedCity = CyInterface().getHeadSelectedCity()
  2270.         pHeadSelectedUnit = CyInterface().getHeadSelectedUnit()
  2271.         
  2272.         xResolution = screen.getXResolution()
  2273.         yResolution = screen.getYResolution()
  2274.  
  2275.         bShift = CyInterface().shiftKey()
  2276.  
  2277.         screen.addPanel( "SelectedUnitPanel", u"", u"", True, False, 8, yResolution - 140, 280, 130, PanelStyles.PANEL_STYLE_STANDARD )
  2278.         screen.setStyle( "SelectedUnitPanel", "Panel_Game_HudStat_Style" )
  2279.         screen.hide( "SelectedUnitPanel" )
  2280.  
  2281.         screen.addTableControlGFC( "SelectedUnitText", 3, 10, yResolution - 139, 178, 128, False, False, 32, 32, TableStyles.TABLE_STYLE_STANDARD )
  2282.         screen.setStyle( "SelectedUnitText", "Table_EmptyScroll_Style" )
  2283.         screen.hide( "SelectedUnitText" )
  2284.         
  2285.         for i in range(gc.getNumPromotionInfos()):
  2286.             szName = "PromotionButton" + str(i)
  2287.             screen.hide( szName )
  2288.         
  2289.         if CyEngine().isGlobeviewUp():
  2290.             return
  2291.  
  2292.         if (pHeadSelectedCity):
  2293.         
  2294.             iOrders = CyInterface().getNumOrdersQueued()
  2295.  
  2296.             screen.setTableColumnHeader( "SelectedUnitText", 0, u"", 116 )
  2297.             screen.setTableColumnHeader( "SelectedUnitText", 1, u"", 54 )
  2298.             screen.setTableColumnHeader( "SelectedUnitText", 2, u"", 10 )
  2299.             screen.setTableColumnRightJustify( "SelectedUnitText", 1 )
  2300.             
  2301.             for i in range( iOrders ):
  2302.                 
  2303.                 szLeftBuffer = u""
  2304.                 szRightBuffer = u""
  2305.                 
  2306.                 if ( CyInterface().getOrderNodeType(i) == OrderTypes.ORDER_TRAIN ):
  2307.                     szLeftBuffer = gc.getUnitInfo(CyInterface().getOrderNodeData1(i)).getDescription()
  2308.                     szRightBuffer = "(" + str(pHeadSelectedCity.getUnitProductionTurnsLeft(CyInterface().getOrderNodeData1(i), i)) + ")"
  2309.  
  2310.                     if (CyInterface().getOrderNodeSave(i)):
  2311.                         szLeftBuffer = u"*" + szLeftBuffer
  2312.  
  2313.                 elif ( CyInterface().getOrderNodeType(i) == OrderTypes.ORDER_CONSTRUCT ):
  2314.                     szLeftBuffer = gc.getBuildingInfo(CyInterface().getOrderNodeData1(i)).getDescription()
  2315.                     szRightBuffer = "(" + str(pHeadSelectedCity.getBuildingProductionTurnsLeft(CyInterface().getOrderNodeData1(i), i)) + ")"
  2316.  
  2317.                 elif ( CyInterface().getOrderNodeType(i) == OrderTypes.ORDER_CREATE ):
  2318.                     szLeftBuffer = gc.getProjectInfo(CyInterface().getOrderNodeData1(i)).getDescription()
  2319.                     szRightBuffer = "(" + str(pHeadSelectedCity.getProjectProductionTurnsLeft(CyInterface().getOrderNodeData1(i), i)) + ")"
  2320.  
  2321.                 elif ( CyInterface().getOrderNodeType(i) == OrderTypes.ORDER_MAINTAIN ):
  2322.                     szLeftBuffer = gc.getProcessInfo(CyInterface().getOrderNodeData1(i)).getDescription()
  2323.  
  2324.                 screen.appendTableRow( "SelectedUnitText" )
  2325.                 screen.setTableText( "SelectedUnitText", 0, iRow, szLeftBuffer, "", WidgetTypes.WIDGET_HELP_SELECTED, i, -1, CvUtil.FONT_LEFT_JUSTIFY )
  2326.                 screen.setTableText( "SelectedUnitText", 1, iRow, szRightBuffer, "", WidgetTypes.WIDGET_HELP_SELECTED, i, -1, CvUtil.FONT_RIGHT_JUSTIFY )
  2327.                 screen.show( "SelectedUnitText" )
  2328.                 screen.show( "SelectedUnitPanel" )
  2329.                 iRow += 1
  2330.  
  2331.         elif (pHeadSelectedUnit and CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_SHOW):
  2332.         
  2333.             screen.setTableColumnHeader( "SelectedUnitText", 0, u"", 110 )
  2334.             screen.setTableColumnHeader( "SelectedUnitText", 1, u"", 60 )
  2335.             screen.setTableColumnHeader( "SelectedUnitText", 2, u"", 10 )
  2336.             screen.setTableColumnRightJustify( "SelectedUnitText", 1 )
  2337.             
  2338.             if (CyInterface().mirrorsSelectionGroup()):
  2339.                 pSelectedGroup = pHeadSelectedUnit.getGroup()
  2340.             else:
  2341.                 pSelectedGroup = 0
  2342.  
  2343.             if ((pSelectedGroup == 0) or (pSelectedGroup.getLengthMissionQueue() <= 1)):
  2344.                 if (CyInterface().getLengthSelectionList() > 1):
  2345.                     if (pHeadSelectedUnit):
  2346.                         for i in range(gc.getNumUnitInfos()):
  2347.                             iCount = CyInterface().countEntities(i)
  2348.  
  2349.                             if (iCount > 0):
  2350.                                 szRightBuffer = u""
  2351.                                 
  2352.                                 szLeftBuffer = gc.getUnitInfo(i).getDescription()
  2353.  
  2354.                                 if (iCount > 1):
  2355.                                     szRightBuffer = u"(" + str(iCount) + u")"
  2356.  
  2357.                                 szBuffer = szLeftBuffer + u"  " + szRightBuffer
  2358.                                 screen.appendTableRow( "SelectedUnitText" )
  2359.                                 screen.setTableText( "SelectedUnitText", 0, iRow, szLeftBuffer, "", WidgetTypes.WIDGET_HELP_SELECTED, i, -1, CvUtil.FONT_LEFT_JUSTIFY )
  2360.                                 screen.setTableText( "SelectedUnitText", 1, iRow, szRightBuffer, "", WidgetTypes.WIDGET_HELP_SELECTED, i, -1, CvUtil.FONT_RIGHT_JUSTIFY )
  2361.                                 screen.show( "SelectedUnitText" )
  2362.                                 screen.show( "SelectedUnitPanel" )
  2363.                                 iRow += 1
  2364.                 else:
  2365.                 
  2366.                     szBuffer = localText.getText("INTERFACE_PANE_UNIT_NAME", (pHeadSelectedUnit.getName(), ))
  2367.                     screen.appendTableRow( "SelectedUnitText" )
  2368.                     screen.setTableText( "SelectedUnitText", 0, iRow, szBuffer, "", WidgetTypes.WIDGET_HELP_SELECTED, i, -1, CvUtil.FONT_LEFT_JUSTIFY )
  2369.                     screen.show( "SelectedUnitText" )
  2370.                     screen.show( "SelectedUnitPanel" )
  2371.                     iRow += 1
  2372.  
  2373.                     szBuffer = u""
  2374.  
  2375.                     szLeftBuffer = u""
  2376.                     szRightBuffer = u""
  2377.                     
  2378.                     if (pHeadSelectedUnit.getDomainType() == DomainTypes.DOMAIN_AIR):
  2379.                         if (pHeadSelectedUnit.airBaseCombatStr() > 0):
  2380.                             szLeftBuffer = localText.getText("INTERFACE_PANE_AIR_STRENGTH", ())
  2381.                             if (pHeadSelectedUnit.isHurt()):
  2382.                                 szRightBuffer = u"%.1f/%d%c" %(((float(pHeadSelectedUnit.airBaseCombatStr() * pHeadSelectedUnit.currHitPoints())) / (float(pHeadSelectedUnit.maxHitPoints()))), pHeadSelectedUnit.airBaseCombatStr(), CyGame().getSymbolID(FontSymbols.STRENGTH_CHAR))
  2383.                             else:
  2384.                                 szRightBuffer = u"%d%c" %(pHeadSelectedUnit.airBaseCombatStr(), CyGame().getSymbolID(FontSymbols.STRENGTH_CHAR))
  2385.                     else:
  2386.                         if (pHeadSelectedUnit.canFight()):
  2387.                             szLeftBuffer = localText.getText("INTERFACE_PANE_STRENGTH", ())
  2388.                             if (pHeadSelectedUnit.isHurt()):
  2389.                                 szRightBuffer = u"%.1f/%d%c" %(((float(pHeadSelectedUnit.baseCombatStr() * pHeadSelectedUnit.currHitPoints())) / (float(pHeadSelectedUnit.maxHitPoints()))), pHeadSelectedUnit.baseCombatStr(), CyGame().getSymbolID(FontSymbols.STRENGTH_CHAR))
  2390.                             else:
  2391.                                 szRightBuffer = u"%d%c" %(pHeadSelectedUnit.baseCombatStr(), CyGame().getSymbolID(FontSymbols.STRENGTH_CHAR))
  2392.  
  2393.                     szBuffer = szLeftBuffer + szRightBuffer
  2394.                     if ( szBuffer ):
  2395.                         screen.appendTableRow( "SelectedUnitText" )
  2396.                         screen.setTableText( "SelectedUnitText", 0, iRow, szLeftBuffer, "", WidgetTypes.WIDGET_HELP_SELECTED, i, -1, CvUtil.FONT_LEFT_JUSTIFY )
  2397.                         screen.setTableText( "SelectedUnitText", 1, iRow, szRightBuffer, "", WidgetTypes.WIDGET_HELP_SELECTED, i, -1, CvUtil.FONT_RIGHT_JUSTIFY )
  2398.                         screen.show( "SelectedUnitText" )
  2399.                         screen.show( "SelectedUnitPanel" )
  2400.                         iRow += 1
  2401.  
  2402.                     szLeftBuffer = u""
  2403.                     szRightBuffer = u""
  2404.                 
  2405.                     if ( (pHeadSelectedUnit.movesLeft() % gc.getMOVE_DENOMINATOR()) > 0 ):
  2406.                         iDenom = 1
  2407.                     else:
  2408.                         iDenom = 0
  2409.                     iCurrMoves = ((pHeadSelectedUnit.movesLeft() / gc.getMOVE_DENOMINATOR()) + iDenom )
  2410.                     szLeftBuffer = localText.getText("INTERFACE_PANE_MOVEMENT", ())
  2411.                     if (pHeadSelectedUnit.baseMoves() == iCurrMoves):
  2412.                         szRightBuffer = u"%d%c" %(pHeadSelectedUnit.baseMoves(), CyGame().getSymbolID(FontSymbols.MOVES_CHAR) )
  2413.                     else:
  2414.                         szRightBuffer = u"%d/%d%c" %(iCurrMoves, pHeadSelectedUnit.baseMoves(), CyGame().getSymbolID(FontSymbols.MOVES_CHAR) )
  2415.  
  2416.                     szBuffer = szLeftBuffer + "  " + szRightBuffer
  2417.                     screen.appendTableRow( "SelectedUnitText" )
  2418.                     screen.setTableText( "SelectedUnitText", 0, iRow, szLeftBuffer, "", WidgetTypes.WIDGET_HELP_SELECTED, i, -1, CvUtil.FONT_LEFT_JUSTIFY )
  2419.                     screen.setTableText( "SelectedUnitText", 1, iRow, szRightBuffer, "", WidgetTypes.WIDGET_HELP_SELECTED, i, -1, CvUtil.FONT_RIGHT_JUSTIFY )
  2420.                     screen.show( "SelectedUnitText" )
  2421.                     screen.show( "SelectedUnitPanel" )
  2422.                     iRow += 1
  2423.  
  2424.                     if (pHeadSelectedUnit.getLevel() > 0):
  2425.                     
  2426.                         szLeftBuffer = localText.getText("INTERFACE_PANE_LEVEL", ())
  2427.                         szRightBuffer = u"%d" %(pHeadSelectedUnit.getLevel())
  2428.                         
  2429.                         szBuffer = szLeftBuffer + "  " + szRightBuffer
  2430.                         screen.appendTableRow( "SelectedUnitText" )
  2431.                         screen.setTableText( "SelectedUnitText", 0, iRow, szLeftBuffer, "", WidgetTypes.WIDGET_HELP_SELECTED, i, -1, CvUtil.FONT_LEFT_JUSTIFY )
  2432.                         screen.setTableText( "SelectedUnitText", 1, iRow, szRightBuffer, "", WidgetTypes.WIDGET_HELP_SELECTED, i, -1, CvUtil.FONT_RIGHT_JUSTIFY )
  2433.                         screen.show( "SelectedUnitText" )
  2434.                         screen.show( "SelectedUnitPanel" )
  2435.                         iRow += 1
  2436.  
  2437.                     if (pHeadSelectedUnit.getExperience() > 0):
  2438.                         szLeftBuffer = localText.getText("INTERFACE_PANE_EXPERIENCE", ())
  2439.                         szRightBuffer = u"(%d/%d)" %(pHeadSelectedUnit.getExperience(), pHeadSelectedUnit.experienceNeeded())
  2440.                         szBuffer = szLeftBuffer + "  " + szRightBuffer
  2441.                         screen.appendTableRow( "SelectedUnitText" )
  2442.                         screen.setTableText( "SelectedUnitText", 0, iRow, szLeftBuffer, "", WidgetTypes.WIDGET_HELP_SELECTED, i, -1, CvUtil.FONT_LEFT_JUSTIFY )
  2443.                         screen.setTableText( "SelectedUnitText", 1, iRow, szRightBuffer, "", WidgetTypes.WIDGET_HELP_SELECTED, i, -1, CvUtil.FONT_RIGHT_JUSTIFY )
  2444.                         screen.show( "SelectedUnitText" )
  2445.                         screen.show( "SelectedUnitPanel" )
  2446.                         iRow += 1
  2447.  
  2448.                     iPromotionCount = 0
  2449.                     i = 0
  2450.                     for i in range(gc.getNumPromotionInfos()):
  2451.                         if (pHeadSelectedUnit.isHasPromotion(i)):
  2452.                             szName = "PromotionButton" + str(i)
  2453.                             self.setPromotionButtonPosition( szName, iPromotionCount )
  2454.                             screen.moveToFront( szName )
  2455.                             screen.show( szName )
  2456.  
  2457.                             iPromotionCount = iPromotionCount + 1
  2458.  
  2459.             if (pSelectedGroup):
  2460.             
  2461.                 iNodeCount = pSelectedGroup.getLengthMissionQueue()
  2462.  
  2463.                 if (iNodeCount > 1):
  2464.                     for i in range( iNodeCount ):
  2465.                         szLeftBuffer = u""
  2466.                         szRightBuffer = u""
  2467.                     
  2468.                         if (gc.getMissionInfo(pSelectedGroup.getMissionType(i)).isBuild()):
  2469.                             if (i == 0):
  2470.                                 szLeftBuffer = gc.getBuildInfo(pSelectedGroup.getMissionData1(i)).getDescription()
  2471.                                 szRightBuffer = localText.getText("INTERFACE_CITY_TURNS", (pSelectedGroup.plot().getBuildTurnsLeft(pSelectedGroup.getMissionData1(i), 0, 0), ))                                
  2472.                             else:
  2473.                                 szLeftBuffer = u"%s..." %(gc.getBuildInfo(pSelectedGroup.getMissionData1(i)).getDescription())
  2474.                         else:
  2475.                             szLeftBuffer = u"%s..." %(gc.getMissionInfo(pSelectedGroup.getMissionType(i)).getDescription())
  2476.  
  2477.                         szBuffer = szLeftBuffer + "  " + szRightBuffer
  2478.                         screen.appendTableRow( "SelectedUnitText" )
  2479.                         screen.setTableText( "SelectedUnitText", 0, iRow, szLeftBuffer, "", WidgetTypes.WIDGET_HELP_SELECTED, i, -1, CvUtil.FONT_LEFT_JUSTIFY )
  2480.                         screen.setTableText( "SelectedUnitText", 1, iRow, szRightBuffer, "", WidgetTypes.WIDGET_HELP_SELECTED, i, -1, CvUtil.FONT_RIGHT_JUSTIFY )
  2481.                         screen.show( "SelectedUnitText" )
  2482.                         screen.show( "SelectedUnitPanel" )
  2483.                         iRow += 1
  2484.  
  2485.         return 0
  2486.         
  2487.     # Will update the scores
  2488.     def updateScoreStrings( self ):
  2489.     
  2490.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  2491.  
  2492.         xResolution = screen.getXResolution()
  2493.         yResolution = screen.getYResolution()
  2494.         
  2495.         screen.hide( "ScoreBackground" )
  2496.         
  2497.         for i in range( 20 ):
  2498.             szName = "ScoreText" + str(i)
  2499.             screen.hide( szName )
  2500.  
  2501.         iWidth = 0
  2502.         iCount = 0
  2503.         iBtnHeight = 22
  2504.         
  2505.         if (CyInterface().isScoresVisible() and not CyInterface().isCityScreenUp() and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_MINIMAP_ONLY and CyEngine().isGlobeviewUp() == false):
  2506.  
  2507.             i = gc.getMAX_CIV_TEAMS() - 1
  2508.             while (i > -1):
  2509.                 eTeam = gc.getGame().getRankTeam(i)
  2510.  
  2511.                 if (gc.getTeam(gc.getGame().getActiveTeam()).isHasMet(eTeam) or gc.getTeam(eTeam).isHuman() or gc.getGame().isDebugMode()):
  2512.                     j = gc.getMAX_CIV_PLAYERS() - 1
  2513.                     while (j > -1):
  2514.                         ePlayer = gc.getGame().getRankPlayer(j)
  2515.  
  2516.                         if (gc.getPlayer(ePlayer).isEverAlive() and not gc.getPlayer(ePlayer).isMinorCiv()):
  2517.  
  2518.                             if (gc.getPlayer(ePlayer).getTeam() == eTeam):
  2519.                                 szBuffer = u"<font=2>"
  2520.  
  2521.                                 if (gc.getPlayer(ePlayer).isHuman() and not (gc.getPlayer(ePlayer).isTurnActive())):
  2522.                                     szBuffer = szBuffer + "*"
  2523.  
  2524.                                 if (not CyInterface().isFlashingPlayer(ePlayer) or CyInterface().shouldFlash(ePlayer)):
  2525.                                     if (ePlayer == gc.getGame().getActivePlayer()):
  2526.                                         szTempBuffer = u"%d: [<color=%d,%d,%d,%d>%s</color>]" %(gc.getGame().getPlayerScore(ePlayer), gc.getPlayer(ePlayer).getPlayerTextColorR(), gc.getPlayer(ePlayer).getPlayerTextColorG(), gc.getPlayer(ePlayer).getPlayerTextColorB(), gc.getPlayer(ePlayer).getPlayerTextColorA(), gc.getPlayer(ePlayer).getName())
  2527.                                     else:
  2528.                                         szTempBuffer = u"%d: <color=%d,%d,%d,%d>%s</color>" %(gc.getGame().getPlayerScore(ePlayer), gc.getPlayer(ePlayer).getPlayerTextColorR(), gc.getPlayer(ePlayer).getPlayerTextColorG(), gc.getPlayer(ePlayer).getPlayerTextColorB(), gc.getPlayer(ePlayer).getPlayerTextColorA(), gc.getPlayer(ePlayer).getName())
  2529.                                 else:
  2530.                                     szTempBuffer = u"%d: %s" %(gc.getGame().getPlayerScore(ePlayer), gc.getPlayer(ePlayer).getName())
  2531.                                 szBuffer = szBuffer + szTempBuffer
  2532.  
  2533.                                 if (gc.getTeam(eTeam).isAlive()):
  2534.                                     if ( not (gc.getTeam(gc.getGame().getActiveTeam()).isHasMet(eTeam)) ):
  2535.                                         szBuffer = szBuffer + (" ?")
  2536.                                     if (gc.getTeam(eTeam).isAtWar(gc.getGame().getActiveTeam())):
  2537.                                         szBuffer = szBuffer + "("  + localText.getColorText("TXT_KEY_CONCEPT_WAR", (), gc.getInfoTypeForString("COLOR_RED")).upper() + ")"
  2538.                                     if (gc.getPlayer(ePlayer).canTradeNetworkWith(gc.getGame().getActivePlayer()) and (ePlayer != gc.getGame().getActivePlayer())):
  2539.                                         szTempBuffer = u"%c" %(CyGame().getSymbolID(FontSymbols.TRADE_CHAR))
  2540.                                         szBuffer = szBuffer + szTempBuffer
  2541.                                     if (gc.getTeam(eTeam).isOpenBorders(gc.getGame().getActiveTeam())):
  2542.                                         szTempBuffer = u"%c" %(CyGame().getSymbolID(FontSymbols.OPEN_BORDERS_CHAR))
  2543.                                         szBuffer = szBuffer + szTempBuffer
  2544.                                     if (gc.getTeam(eTeam).isDefensivePact(gc.getGame().getActiveTeam())):
  2545.                                         szTempBuffer = u"%c" %(CyGame().getSymbolID(FontSymbols.DEFENSIVE_PACT_CHAR))
  2546.                                         szBuffer = szBuffer + szTempBuffer
  2547.                                     if (gc.getPlayer(ePlayer).getStateReligion() != -1):
  2548.                                         if (gc.getPlayer(ePlayer).hasHolyCity(gc.getPlayer(ePlayer).getStateReligion())):
  2549.                                             szTempBuffer = u"%c" %(gc.getReligionInfo(gc.getPlayer(ePlayer).getStateReligion()).getHolyCityChar())
  2550.                                             szBuffer = szBuffer + szTempBuffer
  2551.                                         else:
  2552.                                             szTempBuffer = u"%c" %(gc.getReligionInfo(gc.getPlayer(ePlayer).getStateReligion()).getChar())
  2553.                                             szBuffer = szBuffer + szTempBuffer
  2554.                                                 
  2555.                                 if (((gc.getPlayer(ePlayer).getTeam() == gc.getGame().getActiveTeam()) and (gc.getTeam(gc.getGame().getActiveTeam()).getNumMembers() > 1)) or gc.getGame().isDebugMode()):
  2556.                                     if (gc.getPlayer(ePlayer).getCurrentResearch() != -1):
  2557.                                         szTempBuffer = u"-%s (%d)" %(gc.getTechInfo(gc.getPlayer(ePlayer).getCurrentResearch()).getDescription(), gc.getPlayer(ePlayer).getResearchTurnsLeft(gc.getPlayer(ePlayer).getCurrentResearch(), True))
  2558.                                         szBuffer = szBuffer + szTempBuffer
  2559.                                 if (CyInterface().isNetStatsVisible()):
  2560.                                     szBuffer = szBuffer + CyGameTextMgr().getNetStats(ePlayer)
  2561.                                     
  2562.                                 szBuffer = szBuffer + "</font>"
  2563.  
  2564.                                 if ( CyInterface().determineWidth( szBuffer ) > iWidth ):
  2565.                                     iWidth = CyInterface().determineWidth( szBuffer )
  2566.  
  2567.                                 szName = "ScoreText" + str(ePlayer)
  2568.                                 if ( CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_SHOW ):
  2569.                                     yCoord = yResolution - 206
  2570.                                 else:
  2571.                                     yCoord = yResolution - 88
  2572.                                 screen.setText( szName, "Background", szBuffer, CvUtil.FONT_RIGHT_JUSTIFY, xResolution - 12, yCoord - (iCount * iBtnHeight), -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_CONTACT_CIV, ePlayer, -1 )
  2573.                                 screen.show( szName )
  2574.                                 screen.setTextBackgroundPane( szName, gc.getInfoTypeForString("COLOR_BLACK") )
  2575.  
  2576.                                 CyInterface().checkFlashReset(ePlayer)
  2577.  
  2578.                                 iCount = iCount + 1
  2579.                         j = j - 1
  2580.                 i = i - 1
  2581.  
  2582.             if ( CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_SHOW ):
  2583.                 yCoord = yResolution - 186
  2584.             else:
  2585.                 yCoord = yResolution - 68
  2586.             screen.setPanelSize( "ScoreBackground", xResolution - 21 - iWidth, yCoord - (iBtnHeight * iCount) - 4, iWidth + 12, (iBtnHeight * iCount) + 8 )
  2587.             screen.show( "ScoreBackground" )
  2588.  
  2589.     # Will update the help Strings
  2590.     def updateHelpStrings( self ):
  2591.     
  2592.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  2593.  
  2594.         if ( CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_HIDE_ALL ):
  2595.             screen.setHelpTextString( "" )
  2596.         else:
  2597.             screen.setHelpTextString( CyInterface().getHelpString() )
  2598.         
  2599.         return 0
  2600.         
  2601.     # Will set the promotion button position
  2602.     def setPromotionButtonPosition( self, szName, iPromotionCount ):
  2603.         
  2604.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  2605.         
  2606.         # Find out our resolution
  2607.         yResolution = screen.getYResolution()
  2608.  
  2609.         if ( CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_SHOW ):
  2610.             screen.moveItem( szName, 266 - (24 * (iPromotionCount / 6)), yResolution - 144 + (24 * (iPromotionCount % 6)), -0.3 )
  2611.  
  2612.     # Will set the selection button position
  2613.     def setResearchButtonPosition( self, szButtonID, iCount ):
  2614.         
  2615.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  2616.         xResolution = screen.getXResolution()
  2617.         screen.moveItem( szButtonID, 264 + ( ( xResolution - 1024 ) / 2 ) + ( 34 * ( iCount % 15 ) ), 0 + ( 34 * ( iCount / 15 ) ), -0.3 )
  2618.                             
  2619.     # Will set the selection button position
  2620.     def setScoreTextPosition( self, szButtonID, iWhichLine ):
  2621.         
  2622.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  2623.         yResolution = screen.getYResolution()
  2624.         if ( CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_SHOW ):
  2625.             yCoord = yResolution - 180
  2626.         else:
  2627.             yCoord = yResolution - 88
  2628.         screen.moveItem( szButtonID, 996, yCoord - (iWhichLine * 18), -0.3 )
  2629.  
  2630.     # Will build the globeview UI
  2631.     def updateGlobeviewButtons( self ):
  2632.         kInterface = CyInterface()
  2633.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  2634.         xResolution = screen.getXResolution()
  2635.         yResolution = screen.getYResolution()
  2636.  
  2637.         kEngine = CyEngine()
  2638.         kGLM = CyGlobeLayerManager()
  2639.         iNumLayers = kGLM.getNumLayers()
  2640.         iCurrentLayerID = kGLM.getCurrentLayerID()
  2641.         
  2642.         # Positioning things based on the visibility of the globe
  2643.         if kEngine.isGlobeviewUp():
  2644.             screen.setHelpTextArea( 350, FontTypes.SMALL_FONT, 7, yResolution - 50, -0.1, False, "", True, False, CvUtil.FONT_LEFT_JUSTIFY, 150 )
  2645.         else:
  2646.             if ( CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_SHOW ):
  2647.                 screen.setHelpTextArea( 350, FontTypes.SMALL_FONT, 7, yResolution - 172, -0.1, False, "", True, False, CvUtil.FONT_LEFT_JUSTIFY, 150 )
  2648.             else:
  2649.                 screen.setHelpTextArea( 350, FontTypes.SMALL_FONT, 7, yResolution - 50, -0.1, False, "", True, False, CvUtil.FONT_LEFT_JUSTIFY, 150 )
  2650.  
  2651.         
  2652.         # Set base Y position for the LayerOptions, if we find them    
  2653.         if CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_HIDE:
  2654.             iY = yResolution - iGlobeLayerOptionsY_Minimal
  2655.         else:
  2656.             iY = yResolution - iGlobeLayerOptionsY_Regular
  2657.  
  2658.         # Hide the layer options ... all of them
  2659.         for i in range (20):
  2660.             szName = "GlobeLayerOption" + str(i)
  2661.             screen.hide(szName)
  2662.  
  2663.         # Setup the GlobeLayer panel
  2664.         iNumLayers = kGLM.getNumLayers()
  2665.         if kEngine.isGlobeviewUp() and CyInterface().getShowInterface() != InterfaceVisibility.INTERFACE_HIDE_ALL:
  2666.             # set up panel
  2667.             if iCurrentLayerID != -1 and kGLM.getLayer(iCurrentLayerID).getNumOptions() != 0:
  2668.                 bHasOptions = True        
  2669.             else:
  2670.                 bHasOptions = False
  2671.                 screen.hide( "ScoreBackground" )
  2672.  
  2673.             # set up toggle button
  2674.             screen.setState("GlobeToggle", True)
  2675.  
  2676.             # Set GlobeLayer indicators correctly
  2677.             for i in range(kGLM.getNumLayers()):
  2678.                 szButtonID = "GlobeLayer" + str(i)
  2679.                 screen.setState( szButtonID, iCurrentLayerID == i )
  2680.  
  2681.             # Set up options pane
  2682.             if bHasOptions:
  2683.                 kLayer = kGLM.getLayer(iCurrentLayerID)
  2684.  
  2685.                 iCurY = iY
  2686.                 iNumOptions = kLayer.getNumOptions()
  2687.                 iCurOption = kLayer.getCurrentOption()
  2688.                 iMaxTextWidth = -1
  2689.                 for iTmp in range(iNumOptions):
  2690.                     iOption = iTmp # iNumOptions - iTmp - 1
  2691.                     szName = "GlobeLayerOption" + str(iOption)
  2692.                     szCaption = kLayer.getOptionName(iOption)            
  2693.                     if(iOption == iCurOption):
  2694.                         szBuffer = "  <color=255,0,0>%s</color>  " % (szCaption)
  2695.                     else:
  2696.                         szBuffer = "  %s  " % (szCaption)
  2697.                     iTextWidth = CyInterface().determineWidth( szBuffer )
  2698.  
  2699.                     screen.setText( szName, "Background", szBuffer, CvUtil.FONT_LEFT_JUSTIFY, xResolution - 9 - iTextWidth, iCurY-iGlobeLayerOptionHeight-10, -0.3, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GLOBELAYER_OPTION, iOption, -1 )
  2700.                     screen.show( szName )
  2701.  
  2702.                     iCurY -= iGlobeLayerOptionHeight
  2703.  
  2704.                     if iTextWidth > iMaxTextWidth:
  2705.                         iMaxTextWidth = iTextWidth
  2706.  
  2707.                 iPanelWidth = iMaxTextWidth + 32
  2708.                 iPanelHeight = iY - iCurY + 4
  2709.                 iPanelX = xResolution - 14 - iPanelWidth
  2710.                 iPanelY = iCurY - 8
  2711.                 screen.setPanelSize( "ScoreBackground", iPanelX, iPanelY, iPanelWidth, iPanelHeight )
  2712.                 screen.show( "ScoreBackground" )
  2713.  
  2714.         else:
  2715.             if iCurrentLayerID != -1:
  2716.                 kLayer = kGLM.getLayer(iCurrentLayerID)
  2717.                 if kLayer.getName() == "RESOURCES":
  2718.                     screen.setState("ResourceIcons", True)
  2719.                     #kLayer.setCurrentOption(0)
  2720.                 else:
  2721.                     screen.setState("ResourceIcons", False)
  2722.             else:
  2723.                 screen.setState("ResourceIcons", False)
  2724.  
  2725.             screen.hide( "InterfaceGlobeLayerPanel" )
  2726.             screen.setState("GlobeToggle", False )
  2727.  
  2728.     # Update minimap buttons
  2729.     def setMinimapButtonVisibility( self, bVisible):
  2730.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  2731.         kInterface = CyInterface()
  2732.         kGLM = CyGlobeLayerManager()
  2733.         xResolution = screen.getXResolution()
  2734.         yResolution = screen.getYResolution()
  2735.  
  2736.         if ( CyInterface().isCityScreenUp() ):
  2737.             bVisible = False
  2738.         
  2739.         kMainButtons = ["Ping", "Grid", "BareMap", "Yields", "ScoresVisible", "ResourceIcons"]
  2740.         kGlobeButtons = []
  2741.         for i in range(kGLM.getNumLayers()):
  2742.             szButtonID = "GlobeLayer" + str(i)
  2743.             kGlobeButtons.append(szButtonID)
  2744.         
  2745.         if bVisible:
  2746.             if CyEngine().isGlobeviewUp():
  2747.                 kHide = kMainButtons
  2748.                 kShow = kGlobeButtons
  2749.             else:
  2750.                 kHide = kGlobeButtons
  2751.                 kShow = kMainButtons
  2752.             screen.show( "GlobeToggle" )
  2753.             
  2754.         else:
  2755.             kHide = kMainButtons + kGlobeButtons
  2756.             kShow = []
  2757.             screen.hide( "GlobeToggle" )
  2758.         
  2759.         for szButton in kHide:
  2760.             screen.hide(szButton)
  2761.         
  2762.         if CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_HIDE:
  2763.             iY = yResolution - iMinimapButtonsY_Minimal
  2764.             iGlobeY = yResolution - iGlobeButtonY_Minimal 
  2765.         else:
  2766.             iY = yResolution - iMinimapButtonsY_Regular
  2767.             iGlobeY = yResolution - iGlobeButtonY_Regular
  2768.             
  2769.         iBtnX = xResolution - 39
  2770.         screen.moveItem("GlobeToggle", iBtnX, iGlobeY, 0.0)
  2771.         
  2772.         iBtnAdvance = 28
  2773.         iBtnX = iBtnX - len(kShow)*iBtnAdvance - 10
  2774.         if len(kShow) > 0:        
  2775.             i = 0
  2776.             for szButton in kShow:
  2777.                 screen.moveItem(szButton, iBtnX, iY, 0.0)
  2778.                 screen.moveToFront(szButton)
  2779.                 screen.show(szButton)
  2780.                 iBtnX += iBtnAdvance
  2781.                 i += 1
  2782.                 
  2783.     
  2784.     def createGlobeviewButtons( self ):
  2785.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  2786.         
  2787.         xResolution = screen.getXResolution()
  2788.         yResolution = screen.getYResolution()
  2789.         
  2790.         kEngine = CyEngine()
  2791.         kGLM = CyGlobeLayerManager()
  2792.         iNumLayers = kGLM.getNumLayers()
  2793.  
  2794.         for i in range (kGLM.getNumLayers()):
  2795.             szButtonID = "GlobeLayer" + str(i)
  2796.  
  2797.             kLayer = kGLM.getLayer(i)
  2798.             szStyle = kLayer.getButtonStyle()
  2799.             
  2800.             if szStyle == 0 or szStyle == "":
  2801.                 szStyle = "Button_HUDSmall_Style"
  2802.             
  2803.             screen.addCheckBoxGFC( szButtonID, "", "", 0, 0, 28, 28, WidgetTypes.WIDGET_GLOBELAYER, i, -1, ButtonStyles.BUTTON_STYLE_LABEL )
  2804.             screen.setStyle( szButtonID, szStyle )
  2805.             screen.hide( szButtonID )
  2806.                 
  2807.             
  2808.     def createMinimapButtons( self ):
  2809.         screen = CyGInterfaceScreen( "MainInterface", CvScreenEnums.MAIN_INTERFACE )
  2810.         xResolution = screen.getXResolution()
  2811.         yResolution = screen.getYResolution()
  2812.  
  2813.         screen.setImageButton( "Ping", "", 0, 0, 28, 28, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_PING).getActionInfoIndex(), -1 )
  2814.         screen.setStyle( "Ping", "Button_HUDBtnPing_Style" )
  2815.         screen.hide( "Ping" )
  2816.  
  2817.         screen.addCheckBoxGFC( "Grid", "", "", 0, 0, 28, 28, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_GRID).getActionInfoIndex(), -1, ButtonStyles.BUTTON_STYLE_LABEL )
  2818.         screen.setStyle( "Grid", "Button_HUDBtnGrid_Style" )
  2819.         screen.setState( "Grid", False )
  2820.         screen.hide( "Grid" )
  2821.  
  2822.         screen.addCheckBoxGFC( "BareMap", "", "", 0, 0, 28, 28, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_BARE_MAP).getActionInfoIndex(), -1, ButtonStyles.BUTTON_STYLE_LABEL )
  2823.         screen.setStyle( "BareMap", "Button_HUDBtnClearMap_Style" )
  2824.         screen.setState( "BareMap", False )
  2825.         screen.hide( "BareMap" )
  2826.  
  2827.         screen.addCheckBoxGFC( "Yields", "", "", 0, 0, 28, 28, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_YIELDS).getActionInfoIndex(), -1, ButtonStyles.BUTTON_STYLE_LABEL )
  2828.         screen.setStyle( "Yields", "Button_HUDBtnTileAssets_Style" )
  2829.         screen.setState( "Yields", False )
  2830.         screen.hide( "Yields" )
  2831.  
  2832.         screen.addCheckBoxGFC( "ScoresVisible", "", "", 0, 0, 28, 28, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_SCORES).getActionInfoIndex(), -1, ButtonStyles.BUTTON_STYLE_LABEL )
  2833.         screen.setStyle( "ScoresVisible", "Button_HUDBtnRank_Style" )
  2834.         screen.setState( "ScoresVisible", True )
  2835.         screen.hide( "ScoresVisible" )
  2836.  
  2837.         screen.addCheckBoxGFC( "ResourceIcons", "", "", 0, 0, 28, 28, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_RESOURCE_ALL).getActionInfoIndex(), -1, ButtonStyles.BUTTON_STYLE_LABEL )
  2838.         screen.setStyle( "ResourceIcons", "Button_HUDBtnResources_Style" )
  2839.         screen.setState( "ResourceIcons", False )
  2840.         screen.hide( "ResourceIcons" )
  2841.         
  2842.         screen.addCheckBoxGFC( "GlobeToggle", "", "", -1, -1, 36, 36, WidgetTypes.WIDGET_ACTION, gc.getControlInfo(ControlTypes.CONTROL_GLOBELAYER).getActionInfoIndex(), -1, ButtonStyles.BUTTON_STYLE_LABEL )
  2843.         screen.setStyle( "GlobeToggle", "Button_HUDZoom_Style" )
  2844.         screen.setState( "GlobeToggle", False )
  2845.         screen.hide( "GlobeToggle" )
  2846.  
  2847.     # Will handle the input for this screen...
  2848.     def handleInput (self, inputClass):
  2849.         return 0
  2850.     
  2851.     def update(self, fDelta):
  2852.         return
  2853.  
  2854.  
  2855.