[Python] What does canRevolution do?

jkp1187

Unindicted Co-Conspirator
Joined
Aug 29, 2004
Messages
2,496
Location
Pittsburgh, Pennsylvania
Just what the subject says... I'm looking for a way to check to see if a player could initiate a civics change via revolution (i.e., he's not currently barred because he switched civics and thus cannot change civics for another 5 turns.)

The API says:

Code:
bool canRevolution (CivicTypes paeNewCivics)
bool (int (CivicTypes*) paeNewCivics)


But does this permit a check on whether or not a revolution is possible? Or whether or not a revolution to specific civics (e.g., "Theocracy") is currently possible due to player's tech level or wonders?
 
This is defined in CvPlayer.cpp in the SDK.
These things are checked in the order I've written them.

If we are in anarchy, return false.
If our revolution timer is above 0, return false.

If paeNewCivics is NULL (nothing) then return true if we can change any civic to something else.
Else:
If a civic category is forced (UN or whatever) and the civic for that category is not the same as the one that is forced, return false.
If we aren't using the civic, return true. NOTE: this takes place in a loop together with checking if it's forced. If you are checking multiple civic changes it can result in the function returning true even if a later civic category is forced to something else. If you want to check multiple civic changes always use canDoCivics aswell.

return false. (Most likely we tried to change to the civics we already have.)
 
Got it. I looked this up in the CvPlayer.cpp file. All I was really interested in are the functions getRevolutionTimer() and isAnarchy() -- as long as those two are "not greater than zero" and "False", the event can continue. I won't worry about trying to use canRevolution for now.
 
Back
Top Bottom