Simple question: "If Unit Domain = Land"

Cybah

Emperor
Joined
Jun 22, 2007
Messages
1,481
on combat result:

PHP:
if gc.getDomainInfo(unitX.getDomainType()).getType() == gc.getInfoTypeForString("DOMAIN_LAND") and gc.getDomainInfo(unitY.getDomainType()).getType() == gc.getInfoTypeForString("DOMAIN_LAND"):

this does not work (no error). where is the mistake?



edit: must look like this right?

PHP:
if gc.getUnitInfo(pWinner.getUnitType()).getDomainType() == gc.getInfoTypeForString("DOMAIN_LAND") and gc.getUnitInfo(pLoser.getUnitType()).getDomainType() == gc.getInfoTypeForString("DOMAIN_LAND"):


edit2: better should be then...

PHP:
if unitX.getDomainType() == gc.getInfoTypeForString("DOMAIN_LAND") and unitY.getDomainType() == gc.getInfoTypeForString("DOMAIN_LAND"):
 
Have you added your new tag to GlobalDefines and created a new dll with the changes in CvXMLLoadUtilitySet?
 
PHP:
gc.getInfoTypeForString("DOMAIN_LAND")

Where is this string defined?

It isn't. There is no Global Define value for DomainTypes, DomainTypes are enumerated in the SDK. Cybah was simply confused, you use DomainTypes.DOMAIN_LAND in python.
 
in Civ4UnitInfos.xml

PHP:
			<Class>UNITCLASS_LION</Class>
			<Type>UNIT_LION</Type>
(...)
			<Domain>DOMAIN_LAND</Domain>
 
I think somebody never noticed CIV4DomainInfos.xml and, as Cybah pointed out, all those entires in the unit data. When loading the unit data it does this:
Code:
	pXML->GetChildXmlValByName(szTextVal, "Domain");
	m_iDomainType = pXML->FindInInfoClass(szTextVal);
so the various domains had better be in there to be looked up.

The Python gc.getInfoTypeForString("DOMAIN_LAND") ought to work - it's used from time to time including in Rhye's and Fall of Civilization as shipped with BtS and in FfH2 (both of which also use DomainTypes.DOMAIN_LAND).

Using the predefined DomainTypes.DOMAIN_LAND ought to be considerably faster.
 
Back
Top Bottom