Figuring out exactly the RNG call that corresponds to a particular leader should be possible, but sounds like a lot of trial and error. Probably easier and cleaner to use CvInitCore::setLeader to overwrite the assignments made by the EXE. That'll involve reimplementing the logic for enumerating the valid leaders for a given civ (really just need to go through all leaders and check CvCivilizationInfo::isLeaders for each, I think), and the timing is a bit tricky: The EXE needs to be finished with its civ and leader randomization, but the trait effects shouldn't already have been cached (CvPlayer::init). In my mod, I do it immediately when the final setLeader call from the EXE happens:
CvInitCore::setLeaderExternal
Edit: Re-reading my code, I think it's really crucial to do the re-assignment immediately because, otherwise, the EXE won't sychronize the assignments in network games.
The re-routing of external calls (coming from the EXE) to setLeaderExternal (instead of setLeader) happens through the mod's
def file passed to the linker through the
/def
option
here. I don't think you'd need to worry about my Civ/LeaderRandomlyChosen functions (and synchronizing that info in network games); I only keep track of that – iirc – because I want my Settings screen to show which leaders were chosen manually and which ones randomly.
Here is where I check CvCivilizationInfo::isLeaders. I've changed the algorithm so that leaders are chosen directly - rather than first civs and then leaders -, so most of the surrounding code is probably not useful or necessary for what you're attempting.
Edit:
This little trick for setting up the synchronized RNG could be handy.