Is there a function to check Map Size?

phungus420

Deity
Joined
Mar 1, 2003
Messages
6,296
I have this function:
Code:
            # Distance to capital City Distance modified by communication techs and structures
            cityDistModifier = plotDistance( pCity.getX(), pCity.getY(), capital.getX(), capital.getY())
            cityDistModifier = min([cityDistModifier, 27]) - 4

And I want it to go:
Code:
            # Distance to capital City Distance modified by communication techs and structures
            cityDistModifier = plotDistance( pCity.getX(), pCity.getY(), capital.getX(), capital.getY())
            if(#mapsizeHuge)
                cityDistModifier = (min([cityDistModifier, 27]) - 4)*.5
            elif(#mapsizeLarge)
                cityDistModifier = (min([cityDistModifier, 27]) - 4)*.75
#etc.

How do I call up mapsize in Python? Is this even possible mid game?
 
You can get the actual size in plots from CyMap.getMapWidth/Height. It may be possible to retrieve the map size option setting the player chose; but some mapscripts interpret these differently. For example, the vanilla pangaea mapscript "standard" map is a different size than other mapscripts. So using the actual width and height may be safer.
 
I'm still fairly new to Python Coding. I could have made an if, elif, else function with the standard map sizes. Your aproach is more powerful, and accurate, probably better. But I'm not fully clear on how to write it.

I've tried this:

Code:
 cityDistModifier = (k**((CyMap.getMapWidth()**2) + (CyMap.getMapHeight()**2)**0.5))*cityDistModifier
#Where k would be the ratio normalizer, where the standard map size would give me a value of 1.

But it must be incorrect sytax. Becuase it's borked at the moment. I'll fool around with it for a while. Please let me know if you know how the syntax should be written.
 
Got it working, it wasn't a problem with Syntax, per say. Though What I have above wasn't what I wanted. I do have it working now though. The issue was the Command. It's not CyMap.getMapWidth it's CyMap().getGridWidth()
 
Top Bottom