canUpgradeAnywhere?

TC01

Deity
Joined
Jun 28, 2009
Messages
2,216
Location
Irregularly Online
There's a python callback in CvGameUtils.py, "canUpgradeAnywhere", that I cannot find anywhere in the SDK.

Is this hardcoded into the exe?

Final Frontier uses this callback, and I'd like to move the code to the SDK (so rather than list specific examples of units that can "upgrade anywhere", all units flagged by the boolean bStarbase can "upgrade anywhere" instead). But as I said, I can't find it.
 
This function is not in the SDK, it must be hardcoded. RevDCM adds this function though, you can see how it is set up there, as it is fully functional. RevDCM has applied this tag to CvPlayer though, through either CvCivicInfo or CvTraitInfo. Cloning it into CvUnitInfo would actually be easier though, as you would simply drop all the CvPlayer code altogether and jump right into the implimenation of it in CvUnit::isReadyForUpgrade

This is RevDCM's code (to change it for what you want, simply apply the XML tag to UnitInfos, and drop all the Player stuff altogether, just call the bool on the Unit's unitInfo):
Code:
bool CvUnit::isReadyForUpgrade() const
{

/************************************************************************************************/
/* REVDCM                                 02/16/10                                phungus420    */
/*                                                                                              */
/* RevTrait Effects                                                                             */
/************************************************************************************************/
	if ( !GET_PLAYER(getOwnerINLINE()).isUpgradeAnywhere())
	{
		if (!canMove())
		{
			return false;
		}
	}

	if ( !GET_PLAYER(getOwnerINLINE()).isUpgradeAnywhere())
	{
		if (plot()->getTeam() != getTeam())
		{
			return false;
		}
	}
/************************************************************************************************/
/* REVDCM                                  END                                                  */
/************************************************************************************************/

	return true;
}
 
Back
Top Bottom