What does CyArea reference/return?

Lemon Merchant

Not Quite Sonic
Retired Moderator
Joined
Jun 27, 2008
Messages
8,773
Location
Red Sector A
I'm making a little modcomp for BAT, and I ran into some confusion. I'm writing some Python routines to return plot lists and randomly selected plots based on feature or terrain type, etc.

The problem that I'm having is that I can't figure out what CyArea actually refers to, or what any of its' functions return (as in the object Area.) Would I be right in assuming that calling some of the CyArea functions returns things like the city radius?

As a simple example (From the Python API):

To get the number of tiles in an area, I use this function:
Code:
[COLOR=Red]INT[/COLOR] getNumTiles ()
int () - Returns the number of tiles in this area
And using this function gets an object of type CyArea:
Code:
[COLOR=DarkGreen]CyArea[/COLOR] getArea (INT iID)
CyArea (iID) - get CyArea at iID
So if I just write something like (ignore the bad syntax here, it's just an example):
Code:
iMyTileCount = gc.getArea(AreaID).getNumTiles()
In the badly constructed code example above, I'm getting the number of tiles in the Area object that I am specifying with AreaID. But what does the actual Area object refer to?

I am one confused Lemon. :crazyeye:
 
As far as I know, the CyArea class is used to represent continents. It's important for AI behaviour and certain effects (almost everything that works continent wide, like the wonder effects of Notre Dame and the Statue of Liberty).

CyArea.getNumTiles() would get you the amount of tiles that constitute this continent, I suppose.

What exactly are you trying to do?
 
I'm writing a plot routine to loop around a central plot (city, improvement, peak, etc.) and return a list of the plots that surround it.

For example, if you had a city coastal tile, the function would let you find the actual water tiles in the city's owned plots. If there were three water tiles in the radius of the plot loop, it would return a list consisting of those three plots. It's based loosely on the code from the Volcano event in CvRandomEvents.py - the code finds plots to destroy based on proximity to the peak. I was just writing a more general routine that can be called from my little modcomp, which alters graphics on a particular tile, or tiles, for a short time.

If the Area is a continent, I may have to write my own area collecting function. :whew:
 
Note that there are undocumented functions in the SDK that are exposed to Python. If I remember correctly there are functions for the sort of things you're working on...
 
Thanks fellas. I guess a little more research is in order. ;)
 
Top Bottom