Announcement

Collapse
No announcement yet.

Python Help: Corporation Screen

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Python Help: Corporation Screen

    I'm trying to add two lines to the corporation screen.

    1) how much gold the corp hq produces (therefore the overall value of the corporation)

    2) how many cities in the world have that corporation.


    I've done some code before but new to python.

    I *think* I need to add it to this section in the corporation.py

    Code:
    		# Headquarters
    		screen.setLabelAt("", "CivicList", localText.getText("TXT_KEY_CORPORATION_SCREEN_HEADQUARTERS", ()), CvUtil.FONT_LEFT_JUSTIFY, self.LEFT_EDGE_TEXT, self.Y_HEADQUARTERS, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
    
    		xLoop = self.X_CORPORATION_START
    		for i in range(gc.getNumCorporationInfos()):
    			pHeadquarters = gc.getGame().getHeadquarters(i)
    			if pHeadquarters.isNone():
    				szFounded = u"-"
    				screen.setLabelAt("", "CivicList", szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_HEADQUARTERS, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)				
    			elif not pHeadquarters.isRevealed(gc.getPlayer(self.iActivePlayer).getTeam(), False):
    				szFounded = localText.getText("TXT_KEY_UNKNOWN", ())
    				screen.setLabelAt("", "CivicList", szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_HEADQUARTERS, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
    			else:
    				szFounded = pHeadquarters.getName()
    				screen.setLabelAt("", "CivicList", "(%s)" % gc.getPlayer(pHeadquarters.getOwner()).getCivilizationAdjective(0), CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_HEADQUARTERS+8, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
    				screen.setLabelAt("", "CivicList", szFounded, CvUtil.FONT_CENTER_JUSTIFY, xLoop, self.Y_HEADQUARTERS-8, self.DZ, FontTypes.SMALL_FONT, WidgetTypes.WIDGET_GENERAL, -1, -1)
    			xLoop += self.DX_CORPORATION
    					[b] SHOULD IT GO HERE, what does the following do???????????[/b]			
    		self.iCorporationSelected = -1
    		self.iCorporationExamined = self.iCorporationSelected
    		self.iCorporationOriginal = self.iCorporationSelected
    As you can see by my bold note I think it should go there but not sure.

    As far as my code goes I think I found the corp hq gold, which is displayed in the city screen but not sure what part I need:

    Code:
    					if (pHeadSelectedCity.isHeadquartersByType(i)):
    						szTempBuffer = u"%c" %(gc.getCorporationInfo(i).getHeadquarterChar())
    						#szName = "CorporationHeadquarterDDS" + str(i)
    						#screen.show( szName )
    					else:
    						szTempBuffer = u"%c" %(gc.getCorporationInfo(i).getChar())
    					szBuffer = szBuffer + szTempBuffer
    
    					j = 0
    					for j in range(YieldTypes.NUM_YIELD_TYPES):
    						iYield = pHeadSelectedCity.getCorporationYieldByCorporation(j, i)
    
    						if (iYield != 0):
    							if ( iYield > 0 ):
    								szTempBuffer = u"a,%s%d%c" %("+", iYield, gc.getYieldInfo(j).getChar() )
    								szBuffer = szBuffer + szTempBuffer
    							else:
    								szTempBuffer = u"b,%s%d%c" %( "", iYield, gc.getYieldInfo(j).getChar() )
    								szBuffer = szBuffer + szTempBuffer
    						
    					j = 0
    					for j in range(CommerceTypes.NUM_COMMERCE_TYPES):
    						iCommerce = pHeadSelectedCity.getCorporationCommerceByCorporation(j, i)
    
    						if (iCommerce != 0):
    							if ( iCommerce > 0 ):
    								szTempBuffer = u"c,%s%d%c" %("+", iCommerce, gc.getCommerceInfo(j).getChar() )
    								szBuffer = szBuffer + szTempBuffer
    							else:
    								szTempBuffer = u"d,%s%d%c" %( "", iCommerce, gc.getCommerceInfo(j).getChar() )
    								szBuffer = szBuffer + szTempBuffer
    
    					szBuffer += " "


    Lastly for the cities I can't find an example of how to loop all cities on the map.

    I think the above code might be easier if I multiply the commerce to # of total cities (i thik thats what the game does) but I don't see an example of that in the cvMainInterface screen.


    thanks for the help.
    Formerly known as "E" on Apolyton

    See me at Civfanatics.com
Working...
X