Hello,
I've been looking extensively for the code that checks/decide which civ is played when your playing random civ/leader, but cannot find those.
I've multiple reason why I'm looking for this :
- I'm trying to get an "observer" feature up & running, through a new civ, but that civ shouldn't be picked in random civ selection.
- I'd like to bring a new twist to the excellent MODComp of tholish : EralimitedCiv: http://forums.civfanatics.com/showthread.php?t=325547
- I'd like to have an option "play with additionnal civ" which allows, or not, to play with new Civ I'm putting in my MOD.
So far, I've located to part of the code that tends to make me think the code is "hard-coded" in the exe (or whatever else it is) :
A - in CvPlayer :
B- in CvGame
While doing now ok, I'm still pretty new to SDK & Python.
What would be the best way to approach the modification, dynamically (=wheter or not an option is checked), of the list of civ/leaders that can be played ?
Thx a lot and merry Christmas !
I've been looking extensively for the code that checks/decide which civ is played when your playing random civ/leader, but cannot find those.
I've multiple reason why I'm looking for this :
- I'm trying to get an "observer" feature up & running, through a new civ, but that civ shouldn't be picked in random civ selection.
- I'd like to bring a new twist to the excellent MODComp of tholish : EralimitedCiv: http://forums.civfanatics.com/showthread.php?t=325547
- I'd like to have an option "play with additionnal civ" which allows, or not, to play with new Civ I'm putting in my MOD.
So far, I've located to part of the code that tends to make me think the code is "hard-coded" in the exe (or whatever else it is) :
A - in CvPlayer :
Code:
bool CvPlayer::isPlayable() const
{
return [B]GC.getInitCore()[/B].getPlayableCiv(getID());
}
void CvPlayer::setPlayable(bool bNewValue)
{
[B]GC.getInitCore[/B]().setPlayableCiv(getID(), bNewValue);
}
Code:
void CvGame::addPlayer(PlayerTypes eNewPlayer, LeaderHeadTypes eLeader, CivilizationTypes eCiv)
{
PlayerColorTypes eColor = (PlayerColorTypes)GC.getCivilizationInfo(eCiv).getDefaultPlayerColor();
for (int iI = 0; iI < MAX_CIV_PLAYERS; iI++)
{
if (eColor == NO_PLAYERCOLOR || GET_PLAYER((PlayerTypes)iI).getPlayerColor() == eColor)
{
for (int iK = 0; iK < GC.getNumPlayerColorInfos(); iK++)
{
if (iK != GC.getCivilizationInfo((CivilizationTypes)GC.getDefineINT("BARBARIAN_CIVILIZATION")).getDefaultPlayerColor())
{
bool bValid = true;
for (int iL = 0; iL < MAX_CIV_PLAYERS; iL++)
{
if (GET_PLAYER((PlayerTypes)iL).getPlayerColor() == iK)
{
bValid = false;
break;
}
}
if (bValid)
{
eColor = (PlayerColorTypes)iK;
iI = MAX_CIV_PLAYERS;
break;
}
}
}
}
}
TeamTypes eTeam = GET_PLAYER(eNewPlayer).getTeam();
[B]GC.getInitCore().setLeader(eNewPlayer, eLeader);
GC.getInitCore().setCiv(eNewPlayer, eCiv);[/B]
GC.getInitCore().setSlotStatus(eNewPlayer, SS_COMPUTER);
GC.getInitCore().setColor(eNewPlayer, eColor);
GET_TEAM(eTeam).init(eTeam);
GET_PLAYER(eNewPlayer).init(eNewPlayer);
}
While doing now ok, I'm still pretty new to SDK & Python.
What would be the best way to approach the modification, dynamically (=wheter or not an option is checked), of the list of civ/leaders that can be played ?
Thx a lot and merry Christmas !