I'm still trying to get my hire unit concept to work. I have suggesfully moved it to DLL and started writing the AI for it. But now it turns out it isn't working properly with unique units. I use CvPlayer::canTrain function in my checks but it for some reason it returns false with my UUs.
I'm passing the Musketeer unit to the function (it's number 23 in unit infos).
So the eUnit is 23 (Musketeer). eUnitClass is eUnit's unitclass (number 22). Okay, to this point it works. (I have checked the numbers and they are correct) But then in the first check when I get the civilization's UU (23) and compare it to the unit I'm passing (23) it returns true in that check and false from the function.
This is what I have in CivilizationInfos.xml

That doesn't make sense. Any ideas are welcome.
I'm passing the Musketeer unit to the function (it's number 23 in unit infos).
Code:
bool CvPlayer::canTrain(UnitTypes eUnit, bool bContinue, bool bTestVisible, bool bIgnoreCost) const
{
PROFILE_FUNC();
UnitClassTypes eUnitClass;
int iI;
eUnitClass = ((UnitClassTypes)(GC.getUnitInfo(eUnit).getUnitClassType()));
FAssert(GC.getCivilizationInfo(getCivilizationType()).getCivilizationUnits(eUnitClass) == eUnit);
if (GC.getCivilizationInfo(getCivilizationType()).getCivilizationUnits(eUnitClass) != eUnit)
{
return false;
}
...
This is what I have in CivilizationInfos.xml
Code:
<Unit>
<UnitClassType>UNITCLASS_MUSKETMAN</UnitClassType>
<UnitType>UNIT_FRENCH_MUSKETEER</UnitType>
</Unit>

That doesn't make sense. Any ideas are welcome.