Platy's Peculiar Pleasant Posh Python

Actually, I am not sure why you need to find the best available unit, if you are using a hard coded solution.

Anyway, the advisors pop up in BTS are already doing it, where they are looping through all units which the city can build, and assign a value based on Unit AI, to decide which is the best unit to advise you.
Look into the BTS CvAdvisorUitls since mine no longer do that.

isCargo()
 
Thank you.

(If you don't hard code it it becomes usable in other mods. So if I can come up with a generic solution that woks in C2C then I can give it back to Kathy so others can also use it.)
 
Ultrapack

Replace non naval units spawned from goody huts spawned in water.
In BTS, this will never happen, so it is mainly for mods with island goody huts.
 
Developing Traits

Features:
Gains Points towards Individual Trait XP for certain events.
Additional Trait Benefits based on Individual Trait Level

Developing0000_zps83f2e0f9.jpg


Rate Multiplier:
1) Era Advance (50%)
2) Golden Age (100%)

Effect Multiplier:
1) Has Trait (50%)

So a Creative Leader with Level 10 Creative is as good as another Leader with Level 15 Creative.
 
@Platyping, elsewhere you asked why BUG used localText = CvTranslator() since it does not save much typing for the programmer.

One reason is exactly the same as why you calculate an equation that is used often up front and store it in a variable. It is faster for the player.

Using localText creates the object CvTranslator() once then uses that instance further down the code. Rather that recreating the object every time. It is probably only a small saving but as you know small savings add up.
 
Ultrapack Tech Screen

1) Fix "Add Tech" button shown behind bottom panel, thus unable to click.

2) "Add Tech" button no longer shown when cost > points.
In BTS it is still shown, just that clicking it has no effect.
 
EDIT:
Nope apparently this has nothing to do with anything...would be nice to fix (or at least understand) the asserts but apparently they don't break anything.


Hey Platy, So once again I am trying the great headache to get your GUI to work.

When I run it I get this assert at load up:
File: CvGlobals.cpp
Line: 1773
Expression: eGraphicOptionNum < NUM_GRAPHICOPTION_TYPES
Message:

It happens 4 times.

Now when I did some searching for 'GraphicOptionTypes' I got 20 hits in 9 files with your version, and 6 hits in 3 files in my working BUG version.

6 of your files don't seem important to this, which leaves me with:
CvOptionsScreenCallbackInterface.py (which I do not have in my working BUG version) [it also has the +4 reference in it]
CvMainInterface.py
CvOptionsScreen.py

One of the most notable differences I found between the 2 was in CvOptionsScreen.py
You have added a new line with a + 4 in it.(line 273) and I get the assert message 4 times..
So I am thinking this is not a coincidence, of course I don't understand enough of what this is doing, etc. to formulate any kind of an action. Do I need to add more NUMs in the game core, do I need to expose/unexpose some thing to python, or something else entirely...

Line 108: for iOptionLoop in xrange(GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES):
Line 273: for iOptionLoop in xrange(GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES, GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES + 4):
Line 547: for iOptionLoop in xrange(GraphicOptionTypes.NUM_GRAPHICOPTION_TYPES):

I could really use some help in understanding what this line is doing, what it connects to and how I might resolve the issue.

here also is the graphic Options section of code from CvEnums.h:
Spoiler :
Code:
enum GraphicOptionTypes			// Exposed to Python
{
	NO_GRAPHICOPTION = -1,

	GRAPHICOPTION_SINGLE_UNIT_GRAPHICS,
	GRAPHICOPTION_HEALTH_BARS,
	GRAPHICOPTION_CITY_DETAIL,
	GRAPHICOPTION_NO_COMBAT_ZOOM,
	GRAPHICOPTION_NO_ENEMY_GLOW,
	GRAPHICOPTION_FROZEN_ANIMATIONS,
	GRAPHICOPTION_EFFECTS_DISABLED,
	GRAPHICOPTION_GLOBE_VIEW_BUILDINGS_DISABLED,
	GRAPHICOPTION_FULLSCREEN,
	GRAPHICOPTION_LOWRES_TEXTURES,
	GRAPHICOPTION_HIRES_TERRAIN,
	GRAPHICOPTION_NO_MOVIES,
	GRAPHICOPTION_CITY_RADIUS,
 
Frankly speaking, I have no idea what is your question...
 
Hey platy,

I am working on a new project with your UI, and I get this error.

It happens when I found a religion and open the city screen. I currently only have 1 religion, if that could be connected.

Any thoughts on what might be the issue would be welcome.
 

Attachments

  • division by zero error.png
    division by zero error.png
    37.2 KB · Views: 176
And... Another Question!

I am trying to merge in your Equipment Mod, but I am stuck on a section.

PlatyPediaBonus.py
Equipment:
Spoiler :
Code:
## Equipments ##		
	def placeAllows(self):
		screen = self.top.getScreen()
		panelName = self.top.getNextWidgetName()
		screen.addPanel( panelName, CyTranslator().getText("TXT_KEY_PEDIA_ALLOWS", ()), "", false, true, self.top.X_ITEMS_PANE, self.Y_ALLOWS, self.W_MAIN_PANE, self.H_REQUIRES, PanelStyles.PANEL_STYLE_BLUE50 )

		for eLoopUnit in xrange(gc.getNumUnitInfos()):
			bFound = False
			if (eLoopUnit >= 0):
				if (gc.getUnitInfo(eLoopUnit).getPrereqAndBonus() == self.iBonus):
					bFound = True	
				else:
					j = 0
					while (not bFound and j < gc.getNUM_UNIT_PREREQ_OR_BONUSES()):
						if (gc.getUnitInfo(eLoopUnit).getPrereqOrBonuses(j) == self.iBonus):
							bFound = True
						j += 1
			if bFound:
				szButton = gc.getUnitInfo(eLoopUnit).getButton()
				if self.top.iActivePlayer != -1:
					szButton = gc.getPlayer(self.top.iActivePlayer).getUnitButton(eLoopUnit)
				screen.attachImageButton( panelName, "", szButton, GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT, eLoopUnit, 1, False )

		for eLoopBuilding in xrange(gc.getNumBuildingInfos()):
			bFound = False
			if (gc.getBuildingInfo(eLoopBuilding).getPrereqAndBonus() == self.iBonus):
				bFound = True	
			else:
				j = 0
				while (not bFound and j < gc.getNUM_BUILDING_PREREQ_OR_BONUSES()):
					if (gc.getBuildingInfo(eLoopBuilding).getPrereqOrBonuses(j) == self.iBonus):
						bFound = True
					j += 1
			if bFound:
				screen.attachImageButton( panelName, "", gc.getBuildingInfo(eLoopBuilding).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BUILDING, eLoopBuilding, 1, False )
## Equipments ##

Latest Platy Pedia:
Spoiler :
Code:
	def placeAllows(self):
		screen = self.top.getScreen()
		panelName = self.top.getNextWidgetName()
		screen.addPanel( panelName, CyTranslator().getText("TXT_KEY_PEDIA_ALLOWS", ()), "", false, true, self.top.X_ITEMS_PANE, self.Y_ALLOWS, self.W_MAIN_PANE, self.H_REQUIRES, PanelStyles.PANEL_STYLE_BLUE50 )

		for i in xrange(gc.getNumUnitClassInfos()):
			item = gc.getUnitClassInfo(i).getDefaultUnitIndex()
			if CyGame().getActiveCivilizationType() > -1:
				item = gc.getCivilizationInfo(CyGame().getActiveCivilizationType()).getCivilizationUnits(i)
			if item == -1: continue
			bFound = False
			Info = gc.getUnitInfo(item)
			if Info.getPrereqAndBonus() == self.iBonus:
				bFound = True	
			else:
				for j in xrange(gc.getNUM_UNIT_PREREQ_OR_BONUSES()):
					if Info.getPrereqOrBonuses(j) == self.iBonus:
						bFound = True
						break
			if bFound:
				szButton = Info.getButton()
				if self.top.iActivePlayer > -1:
					szButton = gc.getPlayer(self.top.iActivePlayer).getUnitButton(item)
				screen.attachImageButton(panelName, "", szButton, GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT, item, 1, False )

		for i in xrange(gc.getNumBuildingClassInfos()):
			item = gc.getBuildingClassInfo(i).getDefaultBuildingIndex()
			if CyGame().getActiveCivilizationType() > -1:
				item = gc.getCivilizationInfo(CyGame().getActiveCivilizationType()).getCivilizationBuildings(i)
			if item == -1: continue
			bFound = False
			Info = gc.getBuildingInfo(item)
			if Info.getPrereqAndBonus() == self.iBonus:
				bFound = True	
			else:
				for j in xrange(gc.getNUM_BUILDING_PREREQ_OR_BONUSES()):
					if Info.getPrereqOrBonuses(j) == self.iBonus:
						bFound = True
						break
			if bFound:
				screen.attachImageButton(panelName, "", Info.getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BUILDING, item, 1, False )

		for item in xrange(gc.getNumRouteInfos()):
			bFound = False
			Info = gc.getRouteInfo(item)
			if Info.getPrereqBonus() == self.iBonus:
				bFound = True	
			else:
				for j in xrange(gc.getNUM_ROUTE_PREREQ_OR_BONUSES()):
					if Info.getPrereqOrBonus(j) == self.iBonus:
						bFound = True
						break
			if bFound:
				screen.attachImageButton(panelName, "", Info.getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PYTHON, 6788, item, False)

I don't know what bits are for the equipment specifically, and which bits are old conflicting platypedia code...
 
AND..... Another Question!

This time it's Manufactured Resources.

Again it is the pediabonus file

this one uses standard pedia files, but in platy pedia many of the functions that manufactured resources uses have been removed.

placeYield
placeSpecial

I think, and maybe some more.
So I have no idea where to put the MR code..

Also it comes with a pedia tech file, but I can't actually find any MR marked bits of code from this file..
 
about the faith mod you made a long time ago, i was tinkering with it and wondering if it could be made so that the priest specialist counted towards faith, because as it is the largest empire will always have the most faith because they can build the most buildings, but i feel as though a small specialized civilization (like the vatican in real life) would have more. So i was wondering if it is possible to make specialists count?
 
@lib
Regarding 1st question, check what is in that line, since I have no idea what else you merged.
Regarding all others, when you have merged the UI properly, then try merging those one by one.
No point trying to merge 100 mods when the main one isn't done.

@Faith
Naturally, it can be done, just need some codes on city do turn, to count the specialists.
Which is something similar to what developing traits do.
 
I have merged the UI properly. Well, I only had your UI python in there, with a kmod .dll.

Religion Error code, it's all your UI code or vanilla as far as I can tell.
Spoiler :

CvMianinterface line 1846:
Spoiler :
Code:
## Religions and Corporations ##
				nColumns = min(10, gc.getNumReligionInfos(), gc.getNumCorporationInfos())
				screen.addTableControlGFC("ReligionsCorps", nColumns, xResolution - 252, 42, 250, 50, False, False, 0, 0, TableStyles.TABLE_STYLE_EMPTY)
				for i in xrange(nColumns):				
					screen.setTableColumnHeader("ReligionsCorps", i, "", 250/nColumns)

				iCount = 0
				for i in xrange(gc.getNumReligionInfos()):
					if pHeadSelectedCity.isHasReligion(i):
[COLOR="Red"]						iColumn = iCount % nColumns[/COLOR]
						if iColumn == 0:
							iRow = screen.appendTableRow("ReligionsCorps")
						sText = u"%c" %(gc.getReligionInfo(i).getChar())
						if pHeadSelectedCity.isHolyCityByType(i):
							sText = u"%c" %(gc.getReligionInfo(i).getHolyCityChar())
						screen.setTableText("ReligionsCorps", iColumn, iRow, "<font=4>" + sText + "</font>","", WidgetTypes.WIDGET_HELP_RELIGION_CITY, i, -1, CvUtil.FONT_CENTER_JUSTIFY)
						iCount += 1

				iCount = 0
				for i in xrange(gc.getNumCorporationInfos()):
					if pHeadSelectedCity.isHasCorporation(i):
						iColumn = iCount % nColumns
						if iColumn == 0:
							iRow = screen.appendTableRow("ReligionsCorps")
						sText = u"%c" %(gc.getCorporationInfo(i).getChar())
						if pHeadSelectedCity.isHeadquartersByType(i):
							sText = u"%c" %(gc.getCorporationInfo(i).getHeadquarterChar())
						screen.setTableText("ReligionsCorps", iColumn, iRow, "<font=4>" + sText + "</font>","", WidgetTypes.WIDGET_HELP_CORPORATION_CITY, i, -1, CvUtil.FONT_CENTER_JUSTIFY)
						iCount += 1
## Religions and Corporations ##

Line 564:
Spoiler :
Code:
			# Selection Data Dirty Bit
[COLOR="Red"]			self.updateCityScreen()[/COLOR]
			CyInterface().setDirty(InterfaceDirtyBits.Domestic_Advisor_DIRTY_BIT, True)
			CyInterface().setDirty(InterfaceDirtyBits.CityScreen_DIRTY_BIT, False)

CvScreensInterface Line 480:
Spoiler :
Code:
	# Main Interface Screen
	if ( argsList[0] == MAIN_INTERFACE ):
		[COLOR="Red"]mainInterface.redraw()[/COLOR]
	elif ( argsList[0] == TECH_CHOOSER ):
		techChooser.updateTechRecords(true)

As for the other questions, the main interface is done (apart from this religion issue which is putting the error in your UI code), the other questions are how to merge code that you wrote on old or vanilla pedia code, with your latest UI code, because they have been majorly altered. In the MR case, the code section you used in the bonus file does not even seem to exist in your platypedia code
 
Ah, that one is easy to fix.
It will be 0 if either the mod has no religions or no corporations.
 
aha, that explains it, I just checked the corporations file and there are none, so I guess the birth of the religion starts the check, then there is no corps which throws it for a loop.

I'll make a dummy corp and that should solve it for now. I temporarily fixed it by disabling the religion being founded by a tech.

Now I just need a solution for the pediabonus.py for equipment and Manufactured Resources if memory serves, everything else went in fine, it is just that one file because it is so heavily altered from the version you wrote it in.
 
Ultrapack

Fix bug with city screen for mods with no corps or no religions.
 
Back
Top Bottom