Identifying Wonders

Baldyr

"Hit It"
Joined
Dec 5, 2009
Messages
5,530
Location
Sweden
I don't seem to be able to find anything in the CvBuildingInfo nor the CvBuildingClassInfo class for detecting whether or not a BuildingType is actually a Wonder. All I can think of (for a default BtS game) is fetching CvBuildingInfo.getGreatPeopleUnitClass() and conditioning the return value to be something else than -1.

Any other ideas? :confused:
 
I don't seem to be able to find anything in the CvBuildingInfo nor the CvBuildingClassInfo class for detecting whether or not a BuildingType is actually a Wonder. All I can think of (for a default BtS game) is fetching CvBuildingInfo.getGreatPeopleUnitClass() and conditioning the return value to be something else than -1.

Any other ideas? :confused:

isWorldWonderClass(gc.getBuildingInfo(iBuildingType).getBuildingClassType()) is used in CvEventManager.py and a few other places. There's a isNationalWonderClass too. I don't know why these are not listed in the Python API pages.

Another way would be to use getMaxGlobalInstances(), getMaxTeamInstances() or getMaxPlayerInstances() from CvBuildingClassInfo.
 
Thanks! :king:

Those undocumented function exposed to Python are easy to neglect. I believe someone posted a list of those once, but I can't seem to find it now. :p I can't make heads or tails of the SDK either, so I'm just gonna quit looking and go to bed. :p
 
You can get a good guess which functions are exposed to Python by looking into the Cy[...]Interface.cpp classes even without C++ knowledge. [...] stands for various classes like City, Player etc.
 
Ah, forgot about that. That'll help tons, thanks! :goodjob:
 
Actually, the files that have a class name in their name are the ones already documented on the Python API page.

The additional functions that you can directly call in Python are defined in CyGameCoreUtilsInterface.cpp and implemented in CyGameCoreUtils.cpp/.h and are not part of any object like CyGame or CyPlot. Their definitions do not have the python::class_<CyThingy>("CyThingy") item in them, which would probably be why the script that built the API page didn't find them. These functions are, I expect, included via the ubiquitous "from CvPythonExtensions import *". They are all wrappers for similarly free-standing )not part of a class) functions in the DLL (most, if not all, of which are actually implemented in various .h files, rather than .cpp files).

This is where you'll find isWorldWonderClass, isTeamWonderClass, isNationalWonderClass, isLimitedWonderClass and a bunch of others.
 
I see, I'll have to bookmark this thread for future reference. :cool:
 
Ok, I'm having a new, related, issue. While I can successfully detect World and National Wonders, I can't identify buildings that can only be built by Great People. Since those aren't Wonders and they're not restricted by instance (globally or by team/player). As it turns out, I need to be able to weed out all sorts of non-regular buildings with my script.

Any ideas?
 
I only found a way to check CyUnit instances for available buildings, not CvUnitInfo instances. This is a problem.
 
I'd be damned. I guess it returns True if the unit can construct the building index, then. Great.

Now I need to create a index of all buildings that can be created by great people units. Is there a easy way to identify which units are GP so that I don't have to loop through all UnitType values with every single BuildingType...
 
Great people may all have the Special tag set to SPECIALUNIT_PEOPLE and have a Cost of -1.

They do in BtS, but this sort of thing may be mod dependent.

If you just want great prophets, they probably all have their DefaultUnitAI type set to UNITAI_PROPHET.

You might be better off using a manually selected list...
 
Back
Top Bottom