Hi, Rob; I may have an answer.
I'm guessing it may be because the pathfinder was given UNITAI_DEFENSE (and doesn't have UNITAI_EXPLORE) and it costs 45 instead of the warrior at 40.
So, I thought maybe the game grants the player the most expensive available UNITAI_DEFENSE unit, since they added that extra 5 production and broke the standard (Civ5Eras.xml; StartingDefenseUnits = 1; Civ5HandicapInfos.xml has a StartingDefenseUnits and such for the player too, which gets added, but it's always 0.). The fact that they removed UNITAI_EXPLORE may have helped too, since maybe the game checks if a unit can cover another later free AI type and chooses the one with less first.
Also...
Check out CvPlayer.cpp, and the function at line 1316, void CvPlayer::initFreeUnits(CvGameInitialItemsOverrides& /*kOverrides*/)
I'm not accustomed to C++ and have difficulty reading it.
It looks like the game first checks if a civ has any unique traits which grants free units (or is it looking for unique units?). It then proceeds to check Defense, Worker, and Explore AI types and how many free ones to give out to the player and AI, according to CIV5Eras and CIV5HandicapInfos.
There's also this at the end:
Code:
// If we only have one military unit and it's on defense then change its AI to explore
if(GetNumUnitsWithUnitAI(UNITAI_EXPLORE) == 0)
{
int iLoop;
CvUnit* pLoopUnit;
for(pLoopUnit = firstUnit(&iLoop); pLoopUnit != NULL; pLoopUnit = nextUnit(&iLoop))
{
if(pLoopUnit->AI_getUnitAIType() == UNITAI_DEFENSE)
{
pLoopUnit->AI_setUnitAIType(UNITAI_EXPLORE);
break;
}
}
}
Maybe that was added in to help with the new Pathfinder, and add UNITAI_EXPLORE to the first one, once it's granted as the first free unit.
I don't know... just throwing some things out here, hope it helps.
EDIT: Oops, Mr. Howard beat me to it.