Sto
Should i code today ...
I just started thinking that it would be good if the mod (or, after the next patch, the main game) addressed Colonies too. Adding another game option that makes sure colonies are of the same alignment as the civ from which they broke away (when possible) would be good. When that can't be done (or as a less extreme option), it might be good to block evil civs from releasing good colonies, and vice versa (neutral civs could still liberate or be liberated by civs of any alignment)
This seems easy to do in CvPlayer::getSplitEmpireLeaders. Make 3 pass instead of one for leaders . 1rst time same alignment with the player then if nothing found, alignment neutral then anything.
This is my take on your code in CvGame::init:
It works pretty well. Its just to implement the 3 random alignment options of course and simplify it down as much as possible.
Again this is just a brilliant plan. Ive been wanting to do this for 2 years and could never find a way to do it, your design is brillant.
Perhaps these changes can be good :
Spoiler :
Code:
int iRndCiv = GC.getInfoTypeForString("CIVILIZATION_RANDOM");
int iRndLeaderGood = GC.getInfoTypeForString("LEADER_RANDOM_GOOD");
int iRndLeaderNeutral = GC.getInfoTypeForString("LEADER_RANDOM_NEUTRAL");
int iRndLeaderEvil = GC.getInfoTypeForString("LEADER_RANDOM_EVIL");
int iAlignment;
int iBestLeader = -1;
int iBestCiv = -1;
int iBestValue = -1;
int iValue = 0;
[COLOR="Red"]int iNumLeader = 0;[/COLOR]
for (int iPlayer = 0; iPlayer < MAX_CIV_PLAYERS; iPlayer++)
{
if (GC.getInitCore().getCiv((PlayerTypes)iPlayer) == iRndCiv)
{
if (GC.getInitCore().getLeader((PlayerTypes)iPlayer) == iRndLeaderGood)
{
iAlignment = ALIGNMENT_GOOD;
}
if (GC.getInitCore().getLeader((PlayerTypes)iPlayer) == iRndLeaderNeutral)
{
iAlignment = ALIGNMENT_NEUTRAL;
}
if (GC.getInitCore().getLeader((PlayerTypes)iPlayer) == iRndLeaderEvil)
{
iAlignment = ALIGNMENT_EVIL;
}
for (int iCiv = 0; iCiv < GC.getNumCivilizationInfos(); iCiv++)
{
if (GC.getCivilizationInfo((CivilizationTypes)iCiv).isAIPlayable())
{
for (int iLeader = 0; iLeader < GC.getNumLeaderHeadInfos(); iLeader++)
{
if (GC.getCivilizationInfo((CivilizationTypes)iCiv).isLeaders(iLeader))
{
if (GC.getLeaderHeadInfo((LeaderHeadTypes)iLeader).getAlignment() == iAlignment)
{
[COLOR="Red"]iNumLeader = std::min(4, GC.getCivilizationInfo((CivilizationTypes)iCiv).getNumLeaders());[/COLOR]
iValue = 40000 + GC.getGameINLINE().getSorenRandNum(1000, "Random Leader")[COLOR="Red"] - (iNumLeader * 75)[/COLOR];
for (int iI = 0; iI < MAX_CIV_PLAYERS; iI++)
{
if (GC.getInitCore().getLeader((PlayerTypes)iI) == iLeader)
{
[COLOR="Red"]iValue -= 10000;[/COLOR]
}
if (GC.getInitCore().getCiv((PlayerTypes)iI) == iCiv)
{
[COLOR="Red"]iValue -= 2000;[/COLOR]
}
}
if (iValue > iBestValue)
{
iBestCiv = iCiv;
iBestLeader = iLeader;
iBestValue = iValue;
}
}
}
}
}
}
GC.getInitCore().setCiv((PlayerTypes)iPlayer, (CivilizationTypes)iBestCiv);
GC.getInitCore().setLeader((PlayerTypes)iPlayer, (LeaderHeadTypes)iBestLeader);
iBestCiv = -1;
iBestLeader = -1;
iBestValue = -1;
}
}
_ Let a little less chances for civ that have more leader available to appear at each game.
_ Be sure another civ will be selected if possible. (250 seems not enough toward 1000)
_ tweak if the game is forced to choose a same leader
Since i can't play without the equalize options and MP options especially. I will continue to work on the mini-MOD and try to achieve to pass the function to python.
Tcho !
IMPORTANT EDIT :
_ You have forgotten to take in count the option unrestricted leaders. You can simply set NO_CIVILIZATION instead of the leader civ, but that requires to disable the civ temporaly for the default civ implementation. (done in the mini MOD)
_ You need also to select yourself all random leaders for the option unrestricted leaders. If not a random leader can be selected and also hyborem, basium ou kourt.
_Hope you have taken a look at the random personality option. You also need to prevenet the random leader in this function. It doesn't check at any time if the leader civ is playable.