Python Performance and Interface Overhaul (PPIO)

  • While mousing over building there used to be something like Actual effects part of the tooltip. It showed computed effects of bonuses of the building. Now it is gone. Is it be possible to bring it back?
This one can't be fixed easily in python without writing a lot of code that is necessary to calculate the actual effect in python.

@makotech222 : Would you like to help me out on the dll side? So that I don't have to write a lot of python code when the dll already has that code lying around, but currently inaccessible to python.

I need (green represents the change):
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
// Python calls this when it needs the building tooltip text.
CyGameTextMgr.cpp
std::wstring CyGameTextMgr::getBuildingHelp(int iBuilding, bool bCivilopediaText, bool bStrategyText, bool bTechChooserText, CyCity* pCity)
{
CvWStringBuffer szBuffer;
GAMETEXT.setBuildingHelp(szBuffer, (BuildingTypes)iBuilding, bCivilopediaText, bStrategyText, bTechChooserText, ((pCity != NULL) ? pCity->getCity() : NULL));
return szBuffer.getCString();​
}
↓↓↓↓↓↓↓↓↓↓↓↓
std::wstring CyGameTextMgr::getBuildingHelp(int iBuilding, bool bCivilopediaText, bool bStrategyText, bool bTechChooserText, CyCity* pCity, bool bActual)
{
CvWStringBuffer szBuffer;
GAMETEXT.setBuildingHelp(szBuffer, (BuildingTypes)iBuilding, bCivilopediaText, bStrategyText, bTechChooserText, ((pCity != NULL) ? pCity->getCity() : NULL), bActual);
return szBuffer.getCString();​
}​
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
CyGameTextMgr.h
std::wstring getBuildingHelp(int iBuilding, bool bCivilopediaText, bool bStrategyText, bool bTechChooserText, CyCity* pCity);
↓↓↓↓↓↓↓↓↓↓↓↓
std::wstring getBuildingHelp(int iBuilding, bool bCivilopediaText, bool bStrategyText, bool bTechChooserText, CyCity* pCity = NULL, bool bActual = False);​
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
// This is the next function called internally in the dll
CvGameTextMgr.cpp
void CvGameTextMgr::setBuildingHelp(CvWStringBuffer &szBuffer, BuildingTypes eBuilding, bool bCivilopediaText, bool bStrategyText, bool bTechChooserText, CvCity* pCity)
{
setBuildingHelpActual(szBuffer, eBuilding, bCivilopediaText, bStrategyText, bTechChooserText, pCity, false);​
}
↓↓↓↓↓↓↓↓↓↓↓↓
void CvGameTextMgr::setBuildingHelp(CvWStringBuffer &szBuffer, BuildingTypes eBuilding, bool bCivilopediaText, bool bStrategyText, bool bTechChooserText, CvCity* pCity, bool bActual)
{
setBuildingHelpActual(szBuffer, eBuilding, bCivilopediaText, bStrategyText, bTechChooserText, pCity, bActual);​
}​
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
CvGameTextMgr.h
DllExport void setBuildingHelp(CvWStringBuffer &szBuffer, BuildingTypes eBuilding, bool bCivilopediaText = false, bool bStrategyText = false, bool bTechChooserText = false, CvCity* pCity = NULL);
↓↓↓↓↓↓↓↓↓↓↓↓
DllExport void setBuildingHelp(CvWStringBuffer &szBuffer, BuildingTypes eBuilding, bool bCivilopediaText = false, bool bStrategyText = false, bool bTechChooserText = false, CvCity* pCity = NULL, bool bActual = False);​
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
CyGameTextMgrInterface.cpp
.def("getBuildingHelp", &CyGameTextMgr::getBuildingHelp, "wstring (int iBuilding, bool bCivilopediaText, bool bStrategyText, bool bTechChooserText, CyCity* pCity)")
↓↓↓↓↓↓↓↓↓↓↓↓
.def("getBuildingHelp", &CyGameTextMgr::getBuildingHelp, "wstring (int iBuilding, bool bCivilopediaText, bool bStrategyText, bool bTechChooserText, CyCity* pCity, bool bActual)")​
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬
There may be more... Not sure.
 
Last edited:
report: when I open city screen and go to build unit menu, I can't exit city screen pressing Esc, I must switch first to building or wonder contruction menu.
Hmm, I've replicated it, it's a real mystery that the exe don't accept the esc hotkey after a unit has been selected in the unit city tab... Clicking the mouse anywhere, after selecting a unit to train, makes the in-city esc hotkey functional again.
I'll look into ways to get the exe to focus on its responsibilities at the end of the python code that is processed whenever a unit is selected in the unit tab. There might be a way... Though I have no idea what it could be right now.
 
@Toffer90,

Why are new functions in dll needed? I thought they already worked previously when mouseover building icons? I think as long as the widget has type Widget_building (or whatever), the mouseover should work properly?
 
@Toffer90,

Why are new functions in dll needed? I thought they already worked previously when mouseover building icons? I think as long as the widget has type Widget_building (or whatever), the mouseover should work properly?
I'm not asking for a new function, I'm asking for more arguments to an already exisitng function.

The problem arises because I don't use the WIDGET_CONSTRUCT, where when hovering over that widget the CvDLLWidgetData.cpp calls for
setBuildingHelpActual(szBuffer, eBuilding, bCivilopediaText, bStrategyText, bTechChooserText, pCity, True)
python will be left in the dark when it comes to creating a tooltip and the dll will create the default BtS tooltip. Same is true when the widget is clicked, python is left in the dark and the dll does everything.

I use WIDGET_GENERAL so that I can customize the control of the widget in python, this is what allows me to use the new tooltip as well as make radical changes to what widget does when clicked and so on.

The only way python currently have to ask for the tooltip text from the dll is:
getBuildingHelp(int iBuilding, bool bCivilopediaText, bool bStrategyText, bool bTechChooserText, CyCity* pCity)
which in the dll will call for:
setBuildingHelp(szBuffer, (BuildingTypes)iBuilding, bCivilopediaText, bStrategyText, bTechChooserText, ((pCity != NULL) ? pCity->getCity() : NULL));
which will again call for:
setBuildingHelpActual(szBuffer, eBuilding, bCivilopediaText, bStrategyText, bTechChooserText, pCity, False);

That's why I need a way for python to ask for
setBuildingHelpActual(szBuffer, eBuilding, bCivilopediaText, bStrategyText, bTechChooserText, pCity, True)
explicitly like so:
getBuildingHelp(int iBuilding, bool bCivilopediaText, bool bStrategyText, bool bTechChooserText, CyCity* pCity, bool bActual)
 
Last edited:
Ah i see, I didn't know you changed widget type. Ill see what I can do. Might get to it today.
Cool, this time I know it will work as expected, unlike last time which was kinda experimental due to messing with input data-streams handled by the exe.

PPIO v0.5.9.6.0.8 ▬ Hotfix
  • A few small improvements.
  • I think I fixed the odd horizontal scrollbar for the city tab filters on low resolutions.
  • Fixed names becoming simply a punctuation mark in the city work queue when they were too long and needed to be cropped.
Raxo, you are like a bot, you liked my message 4 secs after I posted it...
Such a fast response happens often enough with you that it almost scares me. ^^
 
Last edited:
Raxo, you are like a bot, you liked my message 4 secs after I posted it...
Such a fast response happens often enough with you that it almost scares me. ^^
Well I was looking for something else here, when I noticed your post.

Is it possible to "melt" background of etched buttons, so it would be solid color tint instead of noise?
Now I'm just deleting those.
 
Latest version v0.5.9.6.0.8.

Got this when trying to see the world projects. Logs, including pythonDbg, are attached.

upload_2018-8-28_22-0-33.png
 

Attachments

Funny bug: When browsing things in pedia with keys pressing it causes selection slide by two entries:
It moves by one when pressing key, and then moves again when releasing key.

Spoiler :

Opened pedia
Civ4BeyondSword 2018-08-28 23-07-19-57.jpg


Pressed key
Civ4BeyondSword 2018-08-28 23-07-26-98.jpg


Released key
Civ4BeyondSword 2018-08-28 23-07-27-68.jpg




It is unreliable when quickly tapping key.
 
Funny bug: When browsing things in pedia with keys pressing it causes selection slide by two entries:
It moves by one when pressing key, and then moves again when releasing key.
And if you press the key down longer it just keeps going down until you release.
Are you saying it is difficult to tap quick enough for it only to move one up/down? I can increase the cooldown.

PPIO v0.5.9.6.1
Svn 10142
  • Fixed project pedia error reported by KaTiON_PT
  • Overhauled Project pedia pages.
  • You can now watch building/project movies in the pedia by clicking the big icon in top left corner of building/project pages.
    • most movies are only a picture... some still got a movie though.
  • Probably some other nitpick, take it or leave it.
PPIO v0.5.9.6.1.1 ▬ Hotfix
  • Fixed some bugs
  • Added Spy Lesser and Spy Meager Processes
 
Last edited:
And if you press the key down longer it just keeps going down until you release.
Are you saying it is difficult to tap quick enough for it only to move one up/down? I can increase the cooldown.
Yea, cooldown should be longer before it starts moving further, like 1 - 2 seconds not quarter of second, so our grandpas could comfortably browse pedia with keys.

Now it moves one entry when pressing key and another entry when releasing key if holding key for longer than third or half of second.
 
Last edited:
PPIO v0.5.9.6.1.2 ▬ Hotfix
  • Doubled cooldown time between accepted keyboard press in the pedia screen.
    • Cooldown is only used for the Up/Down/Left/Right arrow keys and A/W/S/D keys when browsing the pedia.
 
Yea, cooldown should be longer before it starts moving further, like 1 - 2 seconds not quarter of second, so our grandpas could comfortably browse pedia with keys.

Cheeky. :crazyeye::sleep::eek:
 
PPIO v0.5.9.6.1.2 ▬ Hotfix
  • Doubled cooldown time between accepted keyboard press in the pedia screen.
    • Cooldown is only used for the Up/Down/Left/Right arrow keys and A/W/S/D keys when browsing the pedia.
Still it moves when releasing key, if you don't tap quickly enough (goes by two rows - one when you press key and another when you release it), but fast enough so i doesn't scroll.

It seems like game texts aren't updated to latest assets by the way.
For example promotions game text doesn't have espionage buildups.
 
Last edited:
Back
Top Bottom