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

  1. ## Sid Meier's Civilization 4
  2. ## Copyright Firaxis Games 2005
  3. from CvPythonExtensions import *
  4. import PyHelpers
  5. import CvUtil
  6. import ScreenInput
  7. import CvScreenEnums
  8.  
  9. PyPlayer = PyHelpers.PyPlayer
  10.  
  11. # globals
  12. gc = CyGlobalContext()
  13. ArtFileMgr = CyArtFileMgr()
  14. localText = CyTranslator()
  15.  
  16. class CvReligionScreen:
  17.     "Religion Advisor Screen"
  18.  
  19.     def __init__(self):
  20.         
  21.         self.SCREEN_NAME = "ReligionScreen"
  22.         self.BUTTON_NAME = "ReligionScreenButton"
  23.         self.RELIGION_NAME = "ReligionText"
  24.         self.CONVERT_NAME = "ReligionConvertButton"
  25.         self.CANCEL_NAME = "ReligionCancelButton"
  26.         self.CITY_NAME = "ReligionCity"
  27.         self.HEADER_NAME = "ReligionScreenHeader"
  28.         self.DEBUG_DROPDOWN_ID =  "ReligionDropdownWidget"
  29.         self.AREA1_ID =  "ReligionAreaWidget1"
  30.         self.AREA2_ID =  "ReligionAreaWidget2"
  31.         self.BACKGROUND_ID = "ReligionBackground"
  32.         self.RELIGION_PANEL_ID = "ReligionPanel"
  33.         self.RELIGION_ANARCHY_WIDGET = "ReligionAnarchyWidget"
  34.  
  35.         self.BORDER_WIDTH = 2
  36.         self.BUTTON_SIZE = 48
  37.         self.HIGHLIGHT_EXTRA_SIZE = 4
  38.  
  39.         self.X_SCREEN = 500
  40.         self.Y_SCREEN = 396
  41.         self.W_SCREEN = 1024
  42.         self.H_SCREEN = 768
  43.         self.Z_SCREEN = -6.1
  44.  
  45.         self.Y_TITLE = 8        
  46.         self.Z_TEXT = self.Z_SCREEN - 0.2
  47.         self.DZ = -0.2
  48.         self.Z_CONTROLS = self.Z_TEXT
  49.  
  50.         self.X_EXIT = 994
  51.         self.Y_EXIT = 726
  52.  
  53.         self.X_CANCEL = 552
  54.         self.Y_CANCEL = 726
  55.  
  56.         self.X_ANARCHY = 21
  57.         self.Y_ANARCHY = 726
  58.  
  59.         
  60.         self.LEFT_EDGE_TEXT = 10
  61.         self.X_RELIGION_START = 180
  62.         self.DX_RELIGION = 98
  63.         self.Y_RELIGION = 35
  64.         self.Y_FOUNDED = 90
  65.         self.Y_HOLY_CITY = 115
  66.         self.Y_INFLUENCE = 140
  67.         self.Y_RELIGION_NAME = 58
  68.  
  69.         self.X_RELIGION_AREA = 45
  70.         self.Y_RELIGION_AREA = 84
  71.         self.W_RELIGION_AREA = 934
  72.         self.H_RELIGION_AREA = 175
  73.  
  74.         self.X_CITY1_AREA = 45
  75.         self.X_CITY2_AREA = 522
  76.         self.Y_CITY_AREA = 282
  77.         self.W_CITY_AREA = 457
  78.         self.H_CITY_AREA = 395
  79.         
  80.         self.X_CITY = 10
  81.         self.DY_CITY = 38
  82.  
  83.         self.iReligionExamined = -1
  84.         self.iReligionSelected = -1
  85.         self.iReligionOriginal = -1
  86.         self.iActivePlayer = -1
  87.         
  88.         self.bScreenUp = False
  89.         
  90.         self.ReligionScreenInputMap = {
  91.             self.RELIGION_NAME        : self.ReligionScreenButton,
  92.             self.BUTTON_NAME        : self.ReligionScreenButton,
  93.             self.CONVERT_NAME        : self.ReligionConvert,
  94.             self.CANCEL_NAME        : self.ReligionCancel,
  95.             }    
  96.             
  97.     def getScreen(self):
  98.         return CyGInterfaceScreen(self.SCREEN_NAME, CvScreenEnums.RELIGION_SCREEN)
  99.  
  100.     def interfaceScreen (self):
  101.  
  102.         self.SCREEN_ART = ArtFileMgr.getInterfaceArtInfo("TECH_BG").getPath()
  103.         self.NO_STATE_BUTTON_ART = ArtFileMgr.getInterfaceArtInfo("INTERFACE_BUTTONS_CANCEL").getPath()
  104.         self.EXIT_TEXT = u"<font=4>" + localText.getText("TXT_KEY_PEDIA_SCREEN_EXIT", ()).upper() + "</font>"
  105.         self.CONVERT_TEXT = u"<font=4>" + localText.getText("TXT_KEY_RELIGION_CONVERT", ()).upper() + "</font>"
  106.         self.CANCEL_TEXT = u"<font=4>" + localText.getText("TXT_KEY_SCREEN_CANCEL", ()).upper() + "</font>"
  107.         
  108.         self.iActivePlayer = gc.getGame().getActivePlayer()
  109.  
  110.         self.bScreenUp = True
  111.  
  112.         screen = self.getScreen()
  113.         if screen.isActive():
  114.             return
  115.         screen.setRenderInterfaceOnly(True);
  116.         screen.showScreen( PopupStates.POPUPSTATE_IMMEDIATE, False)
  117.     
  118.         # Set the background and exit button, and show the screen
  119.         screen.setDimensions(screen.centerX(0), screen.centerY(0), self.W_SCREEN, self.H_SCREEN)
  120.  
  121.         screen.addDDSGFC(self.BACKGROUND_ID, ArtFileMgr.getInterfaceArtInfo("MAINMENU_SLIDESHOW_LOAD").getPath(), 0, 0, self.W_SCREEN, self.H_SCREEN, WidgetTypes.WIDGET_GENERAL, -1, -1 )
  122.         screen.addPanel( "TechTopPanel", u"", u"", True, False, 0, 0, self.W_SCREEN, 55, PanelStyles.PANEL_STYLE_TOPBAR )
  123.         screen.addPanel( "TechBottomPanel", u"", u"", True, False, 0, 713, self.W_SCREEN, 55, PanelStyles.PANEL_STYLE_BOTTOMBAR )
  124.         screen.setText(self.CANCEL_NAME, "Background", self.CANCEL_TEXT, CvUtil.FONT_CENTER_JUSTIFY, self.X_CANCEL, self.Y_CANCEL, self.Z_TEXT, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, 1, 0)
  125.  
  126.         screen.showWindowBackground(False)
  127.  
  128.         # Header...
  129.         screen.setLabel(self.HEADER_NAME, "Background", u"<font=4b>" + localText.getText("TXT_KEY_RELIGION_SCREEN_TITLE", ()).upper() + u"</font>", CvUtil.FONT_CENTER_JUSTIFY, self.X_SCREEN, self.Y_TITLE, self.Z_TEXT, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
  130.         
  131.         # Make the scrollable areas for the city list...
  132.  
  133.         if (CyGame().isDebugMode()):
  134.             self.szDropdownName = self.DEBUG_DROPDOWN_ID
  135.             screen.addDropDownBoxGFC(self.szDropdownName, 22, 12, 300, WidgetTypes.WIDGET_GENERAL, -1, -1, FontTypes.GAME_FONT)
  136.             for j in range(gc.getMAX_PLAYERS()):
  137.                 if (gc.getPlayer(j).isAlive()):
  138.                     screen.addPullDownString(self.szDropdownName, gc.getPlayer(j).getName(), j, j, False )
  139.  
  140.         # Draw Religion info
  141.         self.drawReligionInfo()
  142.         
  143.         self.drawCityInfo(self.iReligionSelected)
  144.  
  145.     # Draws the religion buttons and information        
  146.     def drawReligionInfo(self):
  147.             
  148.         screen = self.getScreen()
  149.                 
  150.         # Put everything on a scrollable area
  151.         szArea = self.RELIGION_PANEL_ID
  152.         screen.addPanel(szArea, "", "", False, True, self.X_RELIGION_AREA, self.Y_RELIGION_AREA, self.W_RELIGION_AREA, self.H_RELIGION_AREA, PanelStyles.PANEL_STYLE_MAIN)
  153.             
  154.         # Religion buttons at the top
  155.         xLoop = self.X_RELIGION_START
  156.         for i in range(gc.getNumReligionInfos()):
  157.             szButtonName = self.getReligionButtonName(i)
  158.             if gc.getGame().getReligionGameTurnFounded(i) >= 0:
  159.                 screen.addCheckBoxGFC(szButtonName, gc.getReligionInfo(i).getButton(), ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(), self.X_RELIGION_AREA + xLoop - self.BUTTON_SIZE/2, self.Y_RELIGION_AREA + self.Y_RELIGION - self.BUTTON_SIZE/2, self.BUTTON_SIZE, self.BUTTON_SIZE, WidgetTypes.WIDGET_GENERAL, -1, -1, ButtonStyles.BUTTON_STYLE_LABEL)
  160.             else:
  161.                 screen.setImageButton(szButtonName, gc.getReligionInfo(i).getButtonDisabled(), self.X_RELIGION_AREA + xLoop - self.BUTTON_SIZE/2, self.Y_RELIGION_AREA + self.Y_RELIGION - self.BUTTON_SIZE/2, self.BUTTON_SIZE, self.BUTTON_SIZE, WidgetTypes.WIDGET_GENERAL, -1, -1)
  162.             szName = self.getReligionTextName(i)
  163.             szLabel = gc.getReligionInfo(i).getDescription()
  164. #            if (self.iReligionSelected == i):
  165. #                szLabel = localText.changeTextColor(szLabel, gc.getInfoTypeForString("COLOR_YELLOW"))
  166.             screen.setText(szName, szArea, szLabel, CvUtil.FONT_CENTER_JUSTIFY, xLoop + self.X_RELIGION_AREA, self.Y_RELIGION_AREA + self.Y_RELIGION_NAME, 2*self.DZ, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
  167.             xLoop += self.DX_RELIGION
  168.  
  169.         szButtonName = self.getReligionButtonName(gc.getNumReligionInfos())
  170.         screen.addCheckBoxGFC(szButtonName, self.NO_STATE_BUTTON_ART, ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(), self.X_RELIGION_AREA + xLoop - self.BUTTON_SIZE/2, self.Y_RELIGION_AREA + self.Y_RELIGION - self.BUTTON_SIZE/2, self.BUTTON_SIZE, self.BUTTON_SIZE, WidgetTypes.WIDGET_GENERAL, -1, -1, ButtonStyles.BUTTON_STYLE_LABEL)
  171.  
  172.         szName = self.getReligionTextName(gc.getNumReligionInfos())
  173.         szLabel = localText.getText("TXT_KEY_RELIGION_SCREEN_NO_STATE", ())
  174. #        if (self.iReligionSelected == gc.getNumReligionInfos()):            
  175. #            szLabel = localText.changeTextColor(szLabel, gc.getInfoTypeForString("COLOR_YELLOW"))
  176.         screen.setText(szName, szArea, szLabel, CvUtil.FONT_CENTER_JUSTIFY, xLoop + self.X_RELIGION_AREA, self.Y_RELIGION_AREA + self.Y_RELIGION_NAME, 2*self.DZ, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)        
  177.                 
  178.         # Founded...
  179.         screen.setLabelAt("", szArea, localText.getText("TXT_KEY_RELIGION_SCREEN_DATE_FOUNDED", ()), CvUtil.FONT_LEFT_JUSTIFY, self.LEFT_EDGE_TEXT, self.Y_FOUNDED, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
  180.  
  181.         # Date Founded:
  182.         xLoop = self.X_RELIGION_START
  183.         for i in range(gc.getNumReligionInfos()):
  184.             if (gc.getGame().getReligionGameTurnFounded(i) < 0):
  185.                 szFounded = localText.getText("TXT_KEY_RELIGION_SCREEN_NOT_FOUNDED", ())
  186.             else:
  187.                 szFounded = CyGameTextMgr().getTimeStr(gc.getGame().getReligionGameTurnFounded(i), false)
  188.             screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_FOUNDED, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
  189.             xLoop += self.DX_RELIGION
  190.             
  191.         screen.setLabelAt("", szArea, "", CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_FOUNDED, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
  192.         
  193.         # Holy City...
  194.         screen.setLabelAt("", szArea, localText.getText("TXT_KEY_RELIGION_SCREEN_HOLY_CITY", ()), CvUtil.FONT_LEFT_JUSTIFY, self.LEFT_EDGE_TEXT, self.Y_HOLY_CITY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
  195.  
  196.         xLoop = self.X_RELIGION_START
  197.         for i in range(gc.getNumReligionInfos()):
  198.             pHolyCity = gc.getGame().getHolyCity(i)
  199.             if pHolyCity.isNone():
  200.                 szFounded = localText.getText("TXT_KEY_NONE", ())
  201.                 screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_HOLY_CITY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
  202.             elif not pHolyCity.isRevealed(gc.getPlayer(self.iActivePlayer).getTeam(), False):
  203.                 szFounded = localText.getText("TXT_KEY_UNKNOWN", ())
  204.                 screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_HOLY_CITY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
  205.             else:
  206.                 szFounded = pHolyCity.getName()
  207.                 screen.setLabelAt("", szArea, "(%s)" % gc.getPlayer(pHolyCity.getOwner()).getCivilizationAdjective(0), CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_HOLY_CITY+8, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
  208.                 screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_HOLY_CITY-8, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
  209.             xLoop += self.DX_RELIGION
  210.  
  211.         szFounded = "-"
  212.         screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_HOLY_CITY, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
  213.  
  214.         # Influence...
  215.         screen.setLabelAt("", szArea, localText.getText("TXT_KEY_RELIGION_SCREEN_INFLUENCE", ()), CvUtil.FONT_LEFT_JUSTIFY, self.LEFT_EDGE_TEXT, self.Y_INFLUENCE, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
  216.  
  217.         xLoop = self.X_RELIGION_START
  218.         for i in range(gc.getNumReligionInfos()):
  219.             if (gc.getGame().getReligionGameTurnFounded(i) < 0):
  220.                 szFounded = "0%"
  221.             else:
  222.                 szFounded = str(gc.getGame().calculateReligionPercent(i)) + "%"
  223.             screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_INFLUENCE, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
  224.             xLoop += self.DX_RELIGION
  225.             
  226.         szFounded = "-"
  227.         screen.setLabelAt("", szArea, szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_INFLUENCE, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
  228.                                 
  229.         self.iReligionSelected = gc.getPlayer(self.iActivePlayer).getStateReligion()
  230.         if (self.iReligionSelected == -1):
  231.             self.iReligionSelected = gc.getNumReligionInfos()
  232.         self.iReligionExamined = self.iReligionSelected
  233.         self.iReligionOriginal = self.iReligionSelected
  234.  
  235.     # Draws the city list
  236.     def drawCityInfo(self, iReligion):
  237.     
  238.         if (not self.bScreenUp):
  239.             return
  240.             
  241.         screen = self.getScreen()
  242.  
  243.         if (iReligion == gc.getNumReligionInfos()):
  244.             iLinkReligion = -1
  245.         else:
  246.             iLinkReligion = iReligion
  247.  
  248.         szArea1 = self.AREA1_ID
  249.         screen.addPanel(self.AREA1_ID, "", "", True, True, self.X_CITY1_AREA, self.Y_CITY_AREA, self.W_CITY_AREA, self.H_CITY_AREA, PanelStyles.PANEL_STYLE_MAIN)
  250.                     
  251.         szArea2 = self.AREA2_ID
  252.         screen.addPanel(self.AREA2_ID, "", "", True, True, self.X_CITY2_AREA, self.Y_CITY_AREA, self.W_CITY_AREA, self.H_CITY_AREA, PanelStyles.PANEL_STYLE_MAIN)
  253.  
  254.  
  255.         szArea = self.RELIGION_PANEL_ID
  256.         xLoop = self.X_RELIGION_START
  257.         for i in range(gc.getNumReligionInfos()):
  258.             if (self.iReligionSelected == i):
  259.                 screen.setState(self.getReligionButtonName(i), True)
  260.             else:
  261.                 screen.setState(self.getReligionButtonName(i), False)
  262.  
  263.         if (self.iReligionSelected == gc.getNumReligionInfos()):            
  264.             screen.setState(self.getReligionButtonName(gc.getNumReligionInfos()), True)
  265.         else:
  266.             screen.setState(self.getReligionButtonName(gc.getNumReligionInfos()), False)
  267.                     
  268.         iPlayer = PyPlayer(self.iActivePlayer)
  269.     
  270.         cityList = iPlayer.getCityList()
  271.         
  272.         # Loop through the cities
  273.         yLoop = 10
  274.         xLoop = self.X_CITY
  275.         xBorderLoop = 0
  276.         for i in range(len(cityList)):
  277.         
  278.             bFirstColumn = (i % 2 == 0)
  279.         
  280.             pLoopCity = cityList[i]
  281.  
  282.             # Constructing the City name...
  283.             szCityName = u""
  284.             if pLoopCity.isCapital():
  285.                 szCityName += u"%c" % CyGame().getSymbolID(FontSymbols.STAR_CHAR)
  286.     
  287.             lHolyCity = pLoopCity.getHolyCity()
  288.             if lHolyCity:
  289.                 for iI in range(len(lHolyCity)):
  290.                     szCityName += u"%c" %(gc.getReligionInfo(lHolyCity[iI]).getHolyCityChar())
  291.     
  292.             lReligions = pLoopCity.getReligions()
  293.             if lReligions:
  294.                 for iI in range(len(lReligions)):
  295.                     if lReligions[iI] not in lHolyCity:
  296.                         szCityName += u"%c" %(gc.getReligionInfo(lReligions[iI]).getChar())
  297.     
  298.             szCityName += pLoopCity.getName()[0:17] + "  "
  299.         
  300.             if (iLinkReligion == -1):
  301.                 bFirst = True
  302.                 for iI in range(len(lReligions)):
  303.                     szTempBuffer = CyGameTextMgr().getReligionHelpCity(lReligions[iI], pLoopCity.GetCy(), False, False, False)
  304.                     if (szTempBuffer):
  305.                         if (not bFirst):
  306.                             szCityName += u", "
  307.                         szCityName += szTempBuffer
  308.                         bFirst = False
  309.             else:
  310.                 szCityName += CyGameTextMgr().getReligionHelpCity(iLinkReligion, pLoopCity.GetCy(), False, False, True)
  311.  
  312.             if bFirstColumn:
  313.                 szArea = self.AREA1_ID
  314.             else:
  315.                 szArea = self.AREA2_ID            
  316.             screen.setLabelAt("", szArea, u"<font=3>" + szCityName + u"</font>", CvUtil.FONT_LEFT_JUSTIFY, xLoop, yLoop, self.DZ, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
  317.             
  318.             if (bFirstColumn):
  319.                 xLoop = self.X_CITY + 10
  320.                 xBorderLoop = 10
  321.             else:
  322.                 xLoop = self.X_CITY
  323.                 xBorderLoop = 0
  324.                 yLoop += self.DY_CITY
  325.             
  326.         # Convert Button....
  327.         iLink = 0
  328.         if (gc.getPlayer(self.iActivePlayer).canChangeReligion()):
  329.             iLink = 1
  330.                 
  331.         if (not self.canConvert(iLinkReligion) or iLinkReligion == self.iReligionOriginal):            
  332.             screen.setText(self.CONVERT_NAME, "Background", self.EXIT_TEXT, CvUtil.FONT_RIGHT_JUSTIFY, self.X_EXIT, self.Y_EXIT, self.Z_TEXT, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_GENERAL, 1, 0)
  333.             screen.hide(self.CANCEL_NAME)
  334.             szAnarchyTime = CyGameTextMgr().setConvertHelp(self.iActivePlayer, iLinkReligion)
  335.         else:
  336.             screen.setText(self.CONVERT_NAME, "Background", self.CONVERT_TEXT, CvUtil.FONT_RIGHT_JUSTIFY, self.X_EXIT, self.Y_EXIT, self.Z_TEXT, FontTypes.TITLE_FONT, WidgetTypes.WIDGET_CONVERT, iLinkReligion, 1)
  337.             screen.show(self.CANCEL_NAME)
  338.             szAnarchyTime = localText.getText("TXT_KEY_ANARCHY_TURNS", (gc.getPlayer(self.iActivePlayer).getReligionAnarchyLength(), ))
  339.  
  340.         # Turns of Anarchy Text...
  341.         screen.setLabel(self.RELIGION_ANARCHY_WIDGET, "Background", u"<font=3>" + szAnarchyTime + u"</font>", CvUtil.FONT_LEFT_JUSTIFY, self.X_ANARCHY, self.Y_ANARCHY, self.Z_TEXT, FontTypes.GAME_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
  342.                             
  343.     def getReligionButtonName(self, iReligion):
  344.         szName = self.BUTTON_NAME + str(iReligion)
  345.         return szName
  346.                 
  347.     def getReligionTextName(self, iReligion):
  348.         szName = self.RELIGION_NAME + str(iReligion)
  349.         return szName
  350.                         
  351.     def canConvert(self, iReligion):
  352.         iCurrentReligion = gc.getPlayer(self.iActivePlayer).getStateReligion()
  353.         if (iReligion == gc.getNumReligionInfos()):
  354.             iConvertReligion = -1
  355.         else:
  356.             iConvertReligion = iReligion
  357.                         
  358.         return (iConvertReligion != iCurrentReligion and gc.getPlayer(self.iActivePlayer).canConvert(iConvertReligion))        
  359.         
  360.     # Will handle the input for this screen...
  361.     def handleInput (self, inputClass):
  362.         if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_LISTBOX_ITEM_SELECTED):
  363.             screen = self.getScreen()
  364.             iIndex = screen.getSelectedPullDownID(self.DEBUG_DROPDOWN_ID)
  365.             self.iActivePlayer = screen.getPullDownData(self.DEBUG_DROPDOWN_ID, iIndex)
  366.             self.drawReligionInfo()            
  367.             self.drawCityInfo(self.iReligionSelected)
  368.             return 1
  369.         elif (self.ReligionScreenInputMap.has_key(inputClass.getFunctionName())):    
  370.             'Calls function mapped in ReligionScreenInputMap'
  371.             # only get from the map if it has the key
  372.             
  373.             # get bound function from map and call it
  374.             self.ReligionScreenInputMap.get(inputClass.getFunctionName())(inputClass)
  375.             return 1
  376.         return 0
  377.         
  378.     def update(self, fDelta):
  379.         return
  380.  
  381.     # Religion Button
  382.     def ReligionScreenButton( self, inputClass ):    
  383.         if ( inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED ) :
  384.             if (inputClass.getID() == gc.getNumReligionInfos() or gc.getGame().getReligionGameTurnFounded(inputClass.getID()) >= 0) :
  385.                 self.iReligionSelected = inputClass.getID()
  386.                 self.iReligionExamined = self.iReligionSelected
  387.                 self.drawCityInfo(self.iReligionSelected)
  388.         elif ( inputClass.getNotifyCode() == NotifyCode.NOTIFY_CURSOR_MOVE_ON ) :
  389.             if ( inputClass.getID() == gc.getNumReligionInfos() or gc.getGame().getReligionGameTurnFounded(inputClass.getID()) >= 0) :
  390.                 self.iReligionExamined = inputClass.getID()
  391.                 self.drawCityInfo(self.iReligionExamined)
  392.         elif ( inputClass.getNotifyCode() == NotifyCode.NOTIFY_CURSOR_MOVE_OFF ) :
  393.             self.iReligionExamined = self.iReligionSelected
  394.             self.drawCityInfo(self.iReligionSelected)
  395.         return 0
  396.  
  397.     def ReligionConvert(self, inputClass):
  398.         screen = self.getScreen()
  399.         if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED) :
  400.             screen.hideScreen()
  401.         
  402.     def ReligionCancel(self, inputClass):
  403.         screen = self.getScreen()
  404.         if (inputClass.getNotifyCode() == NotifyCode.NOTIFY_CLICKED) :
  405.             self.iReligionSelected = self.iReligionOriginal
  406.             if (-1 == self.iReligionSelected):
  407.                 self.iReligionSelected = gc.getNumReligionInfos()
  408.             self.drawCityInfo(self.iReligionSelected)
  409.         
  410.