Python Performance and Interface Overhaul (PPIO)

@Toffer90 Updated the dll to allow bActual from python. Did it slightly different than you specced out, because C++ compiler freaked out a bit. Should still work.
 
@Toffer90 Updated the dll to allow bActual from python. Did it slightly different than you specced out, because C++ compiler freaked out a bit. Should still work.
I like how you did it.
Why call a function which only job is to simply call another function, when one can call the other function right away.
I did find the setup a bit odd, seems to me that the function setBuildingHelpActual() should have replaced setBuildingHelp() when it was made.
 
I tihnk the problem was that it was a DLLExport function, and can't be messed with or else the game engine fudgs up.
 
I tihnk the problem was that it was a DLLExport function, and can't be messed with or else the game engine ****s up.
You're probably right, though I wonder why it wasn't simply designed so that if "City is Null" then "bActual is False" else "bActual is True".
All the "actual" text can be turned off in the BUG menu, and I see no reason why the help text for a building for a specified city should not contain the actual text if it was turned on in BUG options.
Then there would be no need for an extra function argument, and the content of the getBuildingHelpActual() could simply have been the content of getBuildingHelp().

There are probably thousands of odd design choices like this around the dll, not a big issue really.
If I ever were to try to mod the dll, I would never get around to actually making something new, I would get stuck in an OCD mania of restructuring what imo is strange code. ^^

Edit: @makotech222
Your change works fine, though there is a problem. the function argument default values does not really work.
So all instances of python calling getBuildingHelp() in core C2C will now get an error about giving too few arguments because they don't give the bActual argument in the function call.'
If we can't figure out why the default values don't work we need to update the SVN adding in False as a last argument to all instances (there are four) of getBuildingHelp(...) in python code.
 
Last edited:
PPIO v0.5.9.6.1.5 ▬ Hotfix
  • Building actual effect text is now displayed in hover-over help panel where appropriate.
  • SVN rev. 10153 (or newer) is now required for modmod to work.
 
Edit: @makotech222
Your change works fine, though there is a problem. the function argument default values does not really work.
So all instances of python calling getBuildingHelp() in core C2C will now get an error about giving too few arguments because they don't give the bActual argument in the function call.'
If we can't figure out why the default values don't work we need to update the SVN adding in False as a last argument to all instances (there are eight) of getBuildingHelp(...) in python code.

The python exports which are called from python don't have default parameters. If a function export is changed the python where it is used must be changed as well.
 
It would be nice if unit actions, that results in creating building in city were right-clickable - that is pedia would open on that building.


Spoiler :

Civ4BeyondSword 2018-09-01 12-14-13-66.jpg



Also tooltips doesn't always disappear and build list in city doesn't always move when clicking on icons (buildings and wonders) - sometimes they leave empty space.

Edit: Serious bug happens when hovering over building to demolish.

Spoiler :

Civ4BeyondSword 2018-09-01 15-52-40-88.jpg

 
Last edited:
It would be nice if unit actions, that results in creating building in city were right-clickable - that is pedia would open on that building.
Unit action buttons are still handled like it is in core C2C, by the dll. I'll get around to working on those buttons eventually, a lot of python code must be written to be able to change what happens when those buttons are interacted with is what I'm saying.
build list in city doesn't always move when clicking on icons (buildings and wonders) - sometimes they leave empty space.
It's designed that way atm, not a bug.
Edit: Serious bug happens when hovering over building to demolish.
K, an oversight, will fix asap.

The python exports which are called from python don't have default parameters. If a function export is changed the python where it is used must be changed as well.
Odd, there are a few examples of python functions that are set up with defaults in the dll where it is also used without all the arguments in python.

Here's two examples:

1. changeInvisibleVisibilityCount
Used two times in CvWorldBuilderScreen.py without all argument given.
pPlot.changeInvisibleVisibilityCount(self.m_iCurrentTeam, self.m_iRevealMode, 1) # 3 Arguments​
CyPlot.h
void changeInvisibleVisibilityCount(int /*TeamTypes*/ eTeam, int /*InvisibleTypes*/ eInvisible, int iChange, int iIntensity = 0); \\ 4 arguments​

2. setForcedAIAutoPlay
Used once in AIAutoPlay.py without all argument given.
game.setForcedAIAutoPlay(idx, 0) # 2 Arguments​
CyGame.h
void setForcedAIAutoPlay(int iPlayer, int iNewValue, bool bForced = false); \\ 3 Arguments​

I'm pretty sure the python code in these cases actually is processed in-game, and that they don't throw a python error about too few arguments given.
If so, what makes these functions different?
 
Last edited:
Odd, there are a few examples of python functions that are set up with defaults in the dll where it is also used without all the arguments in python.

Here's two examples:

1. changeInvisibleVisibilityCount
Used two times in CvWorldBuilderScreen.py without all argument given.
pPlot.changeInvisibleVisibilityCount(self.m_iCurrentTeam, self.m_iRevealMode, 1) # 3 ArgumentsCyPlot.h
void changeInvisibleVisibilityCount(int /*TeamTypes*/ eTeam, int /*InvisibleTypes*/ eInvisible, int iChange, int iIntensity = 0); \\ 4 arguments
2. setForcedAIAutoPlay
Used once in AIAutoPlay.py without all argument given.
game.setForcedAIAutoPlay(idx, 0) # 2 ArgumentsCyGame.h
void setForcedAIAutoPlay(int iPlayer, int iNewValue, bool bForced = false); \\ 3 Arguments
I'm pretty sure the python code in these cases actually is processed in-game, and that they don't throw a python error about too few arguments given.
If so, what makes these functions different?

But those functions only have a default value used at their last parameter and not for multiple parameters.
 
This one happened when selling building.
Traceback (most recent call last):
File "BugEventManager", line 313, in _handleDefaultEvent
File "CvEventManager", line 411, in onModNetMessage
TypeError: buildCityListLeft() takes exactly 3 arguments (1 given)

It got sold despite this error

By the way tooltip doesn't disappear when pressing esc after hovering over icons.

Spoiler :

Civ4BeyondSword 2018-09-01 19-08-15-78.jpg
Civ4BeyondSword 2018-09-01 19-08-19-27.jpg

 
Last edited:
But those functions only have a default value used at their last parameter and not for multiple parameters.
Ok, so default value for the last two parameters is not possible, only for the last one.
What a strange limitation.

@makotech222, try removing the redly marked "pCity = NULL", and leave "bActual = false" as it is.
CyGameTextMgr.h
std::wstring getBuildingHelp(int iBuilding, bool bCivilopediaText, bool bStrategyText, bool bTechChooserText, CyCity* pCity = NULL, bool bActual = False);
 
PPIO v0.5.9.6.1.7 ▬ Hotfix
This one happened when selling building.
Traceback (most recent call last):
File "BugEventManager", line 313, in _handleDefaultEvent
File "CvEventManager", line 411, in onModNetMessage
TypeError: buildCityListLeft() takes exactly 3 arguments (1 given)

By the way tooltip doesn't disappear when pressing esc after hovering over icons.
  • Fixed that stuff.
 
Will do.

Edit: Checked latest SVN without my modmod installed, and I still get a python error about missing an argument in getBuildingHelp when entering building pedia pages.
 
Last edited:
rev 10154 doesn't contain a dll.

Edit: The TextMgr.getBuildingHelp is referenced four times.

  • Assets\Python\Contrib\Sevopedia\SevoPediaBuilding.py, line 345
  • Assets\Python\Contrib\Sevopedia\SevoPediaC2CCulture.py, line 328
  • Assets\Python\Screens\CvInfoScreen.py, line 2222
  • Assets\Python\Screens\CvWonderMovieScreen.py, line 144
 
Last edited:
Tried again with rev. 10155, still getting the error message.

Unless @alberts2 can cast some light on the situation, we will have to abandon any attempt at having default values for the function and add in the last argument to all existing getBuildingHelp() calls in python.

@makotech222 I can do the python change, removing the default values defined in the dll doesn't seem important but it should be done eventually too.
I'll wait a bit to see if alberts responds to the situation.
 
Last edited:
Back
Top Bottom