void CvInitCore::reassignPlayer(PlayerTypes eOldID, PlayerTypes eNewID)
{
FASSERT_BOUNDS(0, MAX_CIV_PLAYERS, eOldID, "CvInitCore::reassignPlayer (eOldID)");
FASSERT_BOUNDS(0, MAX_CIV_PLAYERS, eNewID, "CvInitCore::reassignPlayer (eNewID)");
if ( checkBounds(eOldID, 0, MAX_CIV_PLAYERS) && checkBounds(eNewID, 0, MAX_CIV_PLAYERS) )
{
// *** SAVE TARGET SLOT DETAILS TEMPORARILY
// Temp civ details
CvWString szLeaderName = m_aszLeaderName[eNewID];
CvWString szCivDescription = m_aszCivDescription[eNewID];
CvWString szCivShortDesc = m_aszCivShortDesc[eNewID];
CvWString szCivAdjective = m_aszCivAdjective[eNewID];
CvWString szCivPassword = m_aszCivPassword[eNewID];
CvString szEmail = m_aszEmail[eNewID];
CvString szSmtpHost = m_aszSmtpHost[eNewID];
bool bWhiteFlag = m_abWhiteFlag[eNewID];
CvWString szFlagDecal = m_aszFlagDecal[eNewID];
CivilizationTypes eCiv = m_aeCiv[eNewID];
LeaderHeadTypes eLeader = m_aeLeader[eNewID];
TeamTypes eTeam = m_aeTeam[eNewID];
HandicapTypes eHandicap = m_aeHandicap[eNewID];
PlayerColorTypes eColor = m_aeColor[eNewID];
ArtStyleTypes eArtStyle = m_aeArtStyle[eNewID];
// Temp slot data
SlotStatus eSlotStatus = m_aeSlotStatus[eNewID];
SlotClaim eSlotClaim = m_aeSlotClaim[eNewID];
// Temp civ flags
bool bPlayableCiv = m_abPlayableCiv[eNewID];
bool bMinorNationCiv = m_abMinorNationCiv[eNewID];
// Temp unsaved player data
int iNetID = m_aiNetID[eNewID];
bool bReady = m_abReady[eNewID];
CvString szPythonCheck = m_aszPythonCheck[eNewID];
CvString szXMLCheck = m_aszXMLCheck[eNewID];
// *** SAVE OLD SLOT DETAILS IN NEW SLOT
// New civ details
m_aszLeaderName[eNewID] = m_aszLeaderName[eOldID];
m_aszCivDescription[eNewID] = m_aszCivDescription[eOldID];
m_aszCivShortDesc[eNewID] = m_aszCivShortDesc[eOldID];
m_aszCivAdjective[eNewID] = m_aszCivAdjective[eOldID];
m_aszCivPassword[eNewID] = m_aszCivPassword[eOldID];
m_aszEmail[eNewID] = m_aszEmail[eOldID];
m_aszSmtpHost[eNewID] = m_aszSmtpHost[eOldID];
m_abWhiteFlag[eNewID] = m_abWhiteFlag[eOldID];
m_aszFlagDecal[eNewID] = m_aszFlagDecal[eOldID];
m_aeCiv[eNewID] = m_aeCiv[eOldID];
m_aeLeader[eNewID] = m_aeLeader[eOldID];
m_aeTeam[eNewID] = m_aeTeam[eOldID];
m_aeHandicap[eNewID] = m_aeHandicap[eOldID];
m_aeColor[eNewID] = m_aeColor[eOldID];
m_aeArtStyle[eNewID] = m_aeArtStyle[eOldID];
// New slot data
m_aeSlotStatus[eNewID] = m_aeSlotStatus[eOldID];
m_aeSlotClaim[eNewID] = m_aeSlotClaim[eOldID];
// New civ flags
m_abPlayableCiv[eNewID] = m_abPlayableCiv[eOldID];
m_abMinorNationCiv[eNewID] = m_abMinorNationCiv[eOldID];
// New unsaved player data
m_aiNetID[eNewID] = m_aiNetID[eOldID];
m_abReady[eNewID] = m_abReady[eOldID];
m_aszPythonCheck[eNewID] = m_aszPythonCheck[eOldID];
m_aszXMLCheck[eNewID] = m_aszXMLCheck[eOldID];
// *** SAVE TEMP DETAILS IN OLD SLOT
// New civ details
m_aszLeaderName[eOldID] = szLeaderName;
m_aszCivDescription[eOldID] = szCivDescription;
m_aszCivShortDesc[eOldID] = szCivShortDesc;
m_aszCivAdjective[eOldID] = szCivAdjective;
m_aszCivPassword[eOldID] = szCivPassword;
m_aszEmail[eOldID] = szEmail;
m_aszSmtpHost[eOldID] = szSmtpHost;
m_abWhiteFlag[eOldID] = bWhiteFlag;
m_aszFlagDecal[eOldID] = szFlagDecal;
m_aeCiv[eOldID] = eCiv;
m_aeLeader[eOldID] = eLeader;
m_aeTeam[eOldID] = eTeam;
m_aeHandicap[eOldID] = eHandicap;
m_aeColor[eOldID] = eColor;
m_aeArtStyle[eOldID] = eArtStyle;
// New slot data
m_aeSlotStatus[eOldID] = eSlotStatus;
m_aeSlotClaim[eOldID] = eSlotClaim;
// New civ flags
m_abPlayableCiv[eOldID] = bPlayableCiv;
m_abMinorNationCiv[eOldID] = bMinorNationCiv;
// New unsaved player data
m_aiNetID[eOldID] = iNetID;
m_abReady[eOldID] = bReady;
m_aszPythonCheck[eOldID] = szPythonCheck;
m_aszXMLCheck[eOldID] = szXMLCheck;
// We may have a new active player id...
if (getActivePlayer() == eOldID)
{
setActivePlayer(eNewID);
}
else if (getActivePlayer() == eNewID)
{
setActivePlayer(eOldID);
}
if(CvPlayerAI::areStaticsInitialized())
{
GET_PLAYER(eOldID).updateTeamType();
GET_PLAYER(eNewID).updateTeamType();
GET_PLAYER(eOldID).updateHuman();
GET_PLAYER(eNewID).updateHuman();
}
}
}
//FfH: Added by Kael 04/08/2008
void CvInitCore::reassignPlayerAdvanced(PlayerTypes eOldID, PlayerTypes eNewID, int iTimer)
{
if ( checkBounds(eOldID, 0, MAX_CIV_PLAYERS) && checkBounds(eNewID, 0, MAX_CIV_PLAYERS) )
{
// *** SAVE TARGET SLOT DETAILS TEMPORARILY
// Temp civ details
CvString szEmail = m_aszEmail[eNewID];
CvString szSmtpHost = m_aszSmtpHost[eNewID];
HandicapTypes eHandicap = m_aeHandicap[eNewID];
SlotStatus eSlotStatus = m_aeSlotStatus[eNewID];
SlotClaim eSlotClaim = m_aeSlotClaim[eNewID];
bool bPlayableCiv = m_abPlayableCiv[eNewID];
bool bMinorNationCiv = m_abMinorNationCiv[eNewID];
int iNetID = m_aiNetID[eNewID];
bool bReady = m_abReady[eNewID];
CvString szPythonCheck = m_aszPythonCheck[eNewID];
CvString szXMLCheck = m_aszXMLCheck[eNewID];
m_aszEmail[eNewID] = m_aszEmail[eOldID];
m_aszSmtpHost[eNewID] = m_aszSmtpHost[eOldID];
m_aeHandicap[eNewID] = m_aeHandicap[eOldID];
setSlotStatus(eNewID, m_aeSlotStatus[eOldID]);
m_aeSlotClaim[eNewID] = m_aeSlotClaim[eOldID];
m_abPlayableCiv[eNewID] = m_abPlayableCiv[eOldID];
m_abMinorNationCiv[eNewID] = m_abMinorNationCiv[eOldID];
m_aiNetID[eNewID] = m_aiNetID[eOldID];
m_abReady[eNewID] = m_abReady[eOldID];
m_aszPythonCheck[eNewID] = m_aszPythonCheck[eOldID];
m_aszXMLCheck[eNewID] = m_aszXMLCheck[eOldID];
m_aszEmail[eOldID] = szEmail;
m_aszSmtpHost[eOldID] = szSmtpHost;
m_aeHandicap[eOldID] = eHandicap;
setSlotStatus(eOldID, eSlotStatus);
m_aeSlotClaim[eOldID] = eSlotClaim;
m_abPlayableCiv[eOldID] = bPlayableCiv;
m_abMinorNationCiv[eOldID] = bMinorNationCiv;
m_aiNetID[eOldID] = iNetID;
m_abReady[eOldID] = bReady;
m_aszPythonCheck[eOldID] = szPythonCheck;
m_aszXMLCheck[eOldID] = szXMLCheck;
for (int iI = 0; iI < NUM_PLAYEROPTION_TYPES; iI++)
{
GET_PLAYER(eNewID).setOption((PlayerOptionTypes)iI,GET_PLAYER(eOldID).isOption((PlayerOptionTypes)iI));
GET_PLAYER(eOldID).setOption((PlayerOptionTypes)iI,false);
}
// We may have a new active player id...
if (getActivePlayer() == eOldID)
{
GC.getGameINLINE().setActivePlayer(eNewID);
}
else if (getActivePlayer() == eNewID)
{
setActivePlayer(eOldID);
}
if(CvPlayerAI::areStaticsInitialized())
{
GET_PLAYER(eOldID).updateTeamType();
GET_PLAYER(eNewID).updateTeamType();
GET_PLAYER(eOldID).updateHuman();
GET_PLAYER(eNewID).updateHuman();
}
if (iTimer != -1)
{
GET_PLAYER(eNewID).changeTempPlayerTimer(iTimer);
GET_PLAYER(eNewID).setRealPlayer(eOldID);
}
}
}
//FfH: End Add