pHeadSelectedCity = CyInterface().getHeadSelectedCity()
if ( CyInterface().isCityScreenUp() ):
if (pHeadSelectedCity and CyInterface().getShowInterface() == InterfaceVisibility.INTERFACE_SHOW):
if ( pHeadSelectedCity.angryPopulation(0) < MAX_CITIZEN_BUTTONS ):
iCount = pHeadSelectedCity.angryPopulation(0)
else:
iCount = MAX_CITIZEN_BUTTONS
for i in range(iCount):
bHandled = True
szName = "AngryCitizen" + str(i)
screen.show( szName )
iFreeSpecialistCount = 0
for i in range(gc.getNumSpecialistInfos()):
iFreeSpecialistCount += pHeadSelectedCity.getFreeSpecialistCount(i)
iCount = 0
bHandled = False
if (iFreeSpecialistCount > MAX_CITIZEN_BUTTONS):
for i in range(gc.getNumSpecialistInfos()):
if (pHeadSelectedCity.getFreeSpecialistCount(i) > 0):
if (iCount < MAX_CITIZEN_BUTTONS):
szName = "FreeSpecialist" + str(iCount)
screen.setImageButton( szName, gc.getSpecialistInfo(i).getTexture(), (xResolution - 74 - (26 * iCount)), yResolution - 206, 24, 24, WidgetTypes.WIDGET_FREE_CITIZEN, i, 1 )
screen.show( szName )
bHandled = true
iCount += 1
else:
for i in range(gc.getNumSpecialistInfos()):
for j in range( pHeadSelectedCity.getFreeSpecialistCount(i) ):
if (iCount < MAX_CITIZEN_BUTTONS):
szName = "FreeSpecialist" + str(iCount)
screen.setImageButton( szName, gc.getSpecialistInfo(i).getTexture(), (xResolution - 74 - (26 * iCount)), yResolution - 206, 24, 24, WidgetTypes.WIDGET_FREE_CITIZEN, i, -1 )
screen.show( szName )
bHandled = true
iCount = iCount + 1
for i in range( gc.getNumSpecialistInfos() ):
bHandled = False
if (pHeadSelectedCity.getOwner() == gc.getGame().getActivePlayer() or gc.getGame().isDebugMode()):
if (pHeadSelectedCity.isCitizensAutomated()):
iSpecialistCount = max(pHeadSelectedCity.getSpecialistCount(i), pHeadSelectedCity.getForceSpecialistCount(i))
else:
iSpecialistCount = pHeadSelectedCity.getSpecialistCount(i)
if (pHeadSelectedCity.isSpecialistValid(i, 1) and (pHeadSelectedCity.isCitizensAutomated() or iSpecialistCount < (pHeadSelectedCity.getPopulation() + pHeadSelectedCity.totalFreeSpecialists()))):
szName = "IncreaseSpecialist" + str(i)
screen.show( szName )
szName = "CitizenDisabledButton" + str(i)
screen.show( szName )
if iSpecialistCount > 0:
szName = "CitizenDisabledButton" + str(i)
screen.hide( szName )
szName = "DecreaseSpecialist" + str(i)
screen.show( szName )
if (pHeadSelectedCity.getSpecialistCount(i) < MAX_CITIZEN_BUTTONS):
iCount = pHeadSelectedCity.getSpecialistCount(i)
else:
iCount = MAX_CITIZEN_BUTTONS
j = 0
for j in range( iCount ):
bHandled = True
szName = "CitizenButton" + str((i * 100) + j)
screen.addCheckBoxGFC( szName, gc.getSpecialistInfo(i).getTexture(), "", xResolution - 74 - (26 * j), (yResolution - 272 - (26 * i)), 24, 24, WidgetTypes.WIDGET_CITIZEN, i, j, ButtonStyles.BUTTON_STYLE_LABEL )
screen.show( szName )
szName = "CitizenButtonHighlight" + str((i * 100) + j)
screen.addDDSGFC( szName, ArtFileMgr.getInterfaceArtInfo("BUTTON_HILITE_SQUARE").getPath(), xResolution - 74 - (26 * j), (yResolution - 272 - (26 * i)), 24, 24, WidgetTypes.WIDGET_CITIZEN, i, j )
if ( pHeadSelectedCity.getForceSpecialistCount(i) > j ):
screen.show( szName )
else:
screen.hide( szName )
if ( not bHandled ):
szName = "CitizenDisabledButton" + str(i)
screen.show( szName )