_alphaBeta_
King
I began, and I think finished, the task of combining BULL build 111 with v1.4 of the Unofficial Patch for 3.19.
Two sticky points:
CvGameTextMgr::getOtherRelationsString procedure originally looked like this in the official 3.19:
EF made this change as part of BULL. It was probably an earlier version of the unofficial patch that prompted the change. I'm not sure of the history.
Focusing on the change itself:
v1.4 of the unofficial patch takes this line even further:
There's also numerous other changes in the v1.4 citing 'BETTER_BTS_AI' (pretty much everything below this line is different, same structure, but different). From reading the comments and staring at the code I think all this is doing is cleaning up how "worst enemy" and "at war with" statements are displayed.
What do you BUG guys make of this?
Some undocumented changes that the unofficial patch guys did:
Are these necessary?
Two sticky points:
Sticky Point #1
CvGameTextMgr::getOtherRelationsString procedure originally looked like this in the official 3.19:
Code:
void CvGameTextMgr::getOtherRelationsString(CvWStringBuffer& szString, PlayerTypes eThisPlayer, PlayerTypes eOtherPlayer)
{
if (eThisPlayer == NO_PLAYER || eOtherPlayer == NO_PLAYER)
{
return;
}
CvPlayer& kThisPlayer = GET_PLAYER(eThisPlayer);
CvPlayer& kOtherPlayer = GET_PLAYER(eOtherPlayer);
for (int iTeam = 0; iTeam < MAX_CIV_TEAMS; ++iTeam)
{
CvTeamAI& kTeam = GET_TEAM((TeamTypes) iTeam);
if (kTeam.isAlive() && !kTeam.isMinorCiv() && iTeam != kThisPlayer.getTeam() && iTeam != kOtherPlayer.getTeam())
{
if (kTeam.isHasMet(kOtherPlayer.getTeam()))
{
if (::atWar((TeamTypes) iTeam, kThisPlayer.getTeam()))
{
szString.append(NEWLINE);
szString.append(gDLL->getText(L"TXT_KEY_AT_WAR_WITH", kTeam.getName().GetCString()));
}
if (!kTeam.isHuman() && kTeam.AI_getWorstEnemy() == kThisPlayer.getTeam())
{
szString.append(NEWLINE);
szString.append(gDLL->getText(L"TXT_KEY_WORST_ENEMY_OF", kTeam.getName().GetCString()));
}
}
}
}
}
Code:
void CvGameTextMgr::getOtherRelationsString(CvWStringBuffer& szString, PlayerTypes eThisPlayer, PlayerTypes eOtherPlayer)
{
if (eThisPlayer == NO_PLAYER || eOtherPlayer == NO_PLAYER)
{
return;
}
CvPlayer& kThisPlayer = GET_PLAYER(eThisPlayer);
CvPlayer& kOtherPlayer = GET_PLAYER(eOtherPlayer);
for (int iTeam = 0; iTeam < MAX_CIV_TEAMS; ++iTeam)
{
CvTeamAI& kTeam = GET_TEAM((TeamTypes) iTeam);
if (kTeam.isAlive() && !kTeam.isMinorCiv() && iTeam != kThisPlayer.getTeam() && iTeam != kOtherPlayer.getTeam())
{
[COLOR="Red"]// BUG - Unofficial Patch - start
// EF: don't show enemies status of or wars with players that the active player hasn't met
if (kTeam.isHasMet(kOtherPlayer.getTeam()) && kTeam.isHasMet(GC.getGameINLINE().getActiveTeam()))
// BUG - Unofficial Patch - end[/COLOR] {
if (::atWar((TeamTypes) iTeam, kThisPlayer.getTeam()))
{
szString.append(NEWLINE);
szString.append(gDLL->getText(L"TXT_KEY_AT_WAR_WITH", kTeam.getName().GetCString()));
}
if (!kTeam.isHuman() && kTeam.AI_getWorstEnemy() == kThisPlayer.getTeam())
{
szString.append(NEWLINE);
szString.append(gDLL->getText(L"TXT_KEY_WORST_ENEMY_OF", kTeam.getName().GetCString()));
}
}
}
}
}
Focusing on the change itself:
Code:
if (kTeam.isHasMet(kOtherPlayer.getTeam()))
if (kTeam.isHasMet(kOtherPlayer.getTeam()) [COLOR="Red"]&& kTeam.isHasMet(GC.getGameINLINE().getActiveTeam()))[/COLOR]
v1.4 of the unofficial patch takes this line even further:
Code:
if (kTeam.isHasMet(kOtherPlayer.getTeam()) && kTeam.isHasMet(kThisPlayer.getTeam()) && kTeam.isHasMet(GC.getGameINLINE().getActiveTeam()))
Code:
void CvGameTextMgr::getOtherRelationsString(CvWStringBuffer& szString, PlayerTypes eThisPlayer, PlayerTypes eOtherPlayer)
{
if (eThisPlayer == NO_PLAYER || eOtherPlayer == NO_PLAYER)
{
return;
}
CvPlayer& kThisPlayer = GET_PLAYER(eThisPlayer);
CvPlayer& kOtherPlayer = GET_PLAYER(eOtherPlayer);
/************************************************************************************************/
/* BETTER_BTS_AI 11/08/08 jdog5000 */
/* */
/* */
/************************************************************************************************/
/* original code
for (int iTeam = 0; iTeam < MAX_CIV_TEAMS; ++iTeam)
{
CvTeamAI& kTeam = GET_TEAM((TeamTypes) iTeam);
if (kTeam.isAlive() && !kTeam.isMinorCiv() && iTeam != kThisPlayer.getTeam() && iTeam != kOtherPlayer.getTeam())
{
if (kTeam.isHasMet(kOtherPlayer.getTeam()))
{
if (::atWar((TeamTypes) iTeam, kThisPlayer.getTeam()))
{
szString.append(NEWLINE);
szString.append(gDLL->getText(L"TXT_KEY_AT_WAR_WITH", kTeam.getName().GetCString()));
}
if (!kTeam.isHuman() && kTeam.AI_getWorstEnemy() == kThisPlayer.getTeam())
{
szString.append(NEWLINE);
szString.append(gDLL->getText(L"TXT_KEY_WORST_ENEMY_OF", kTeam.getName().GetCString()));
}
}
}
}
*/
// Put all war, worst enemy strings on one line
CvWStringBuffer szWarWithString;
CvWStringBuffer szWorstEnemyString;
bool bFirst = true;
bool bFirst2 = true;
for (int iTeam = 0; iTeam < MAX_CIV_TEAMS; ++iTeam)
{
CvTeamAI& kTeam = GET_TEAM((TeamTypes) iTeam);
if (kTeam.isAlive() && !kTeam.isMinorCiv() && iTeam != kThisPlayer.getTeam() && iTeam != kOtherPlayer.getTeam())
{
/************************************************************************************************/
/* UNOFFICIAL_PATCH 09/28/09 Emperor Fool & jdog5000 */
/* */
/* */
/************************************************************************************************/
/* original bts code
if (kTeam.isHasMet(kOtherPlayer.getTeam()))
*/
[COLOR="Red"] if (kTeam.isHasMet(kOtherPlayer.getTeam()) && kTeam.isHasMet(kThisPlayer.getTeam()) && kTeam.isHasMet(GC.getGameINLINE().getActiveTeam()))[/COLOR]
/************************************************************************************************/
/* UNOFFICIAL_PATCH END */
/************************************************************************************************/
{
if (::atWar((TeamTypes) iTeam, kThisPlayer.getTeam()))
{
setListHelp(szWarWithString, L"", kTeam.getName().GetCString(), L", ", bFirst);
bFirst = false;
}
if ( !kTeam.isHuman() && kTeam.AI_getWorstEnemy() == kThisPlayer.getTeam() )
{
setListHelp(szWorstEnemyString, L"", kTeam.getName().GetCString(), L", ", bFirst2);
bFirst2 = false;
}
}
}
}
if( !szWorstEnemyString.isEmpty() )
{
CvWString szTempBuffer;
szTempBuffer.assign(gDLL->getText(L"TXT_KEY_WORST_ENEMY_OF", szWorstEnemyString));
szString.append(NEWLINE);
szString.append(szTempBuffer);
}
if( !szWarWithString.isEmpty() )
{
CvWString szTempBuffer;
szTempBuffer.assign(gDLL->getText(L"TXT_KEY_AT_WAR_WITH", szWarWithString));
szString.append(NEWLINE);
szString.append(szTempBuffer);
}
/************************************************************************************************/
/* BETTER_BTS_AI END */
/************************************************************************************************/
}
Sticky Point #2
Some undocumented changes that the unofficial patch guys did:
Code:
int CvTeamAI::AI_calculateAdjacentLandPlots(TeamTypes eTeam) const
{
[COLOR="Red"]PROFILE_FUNC();[/COLOR]
bool CvUnit::canMoveInto(const CvPlot* pPlot, bool bAttack, bool bDeclareWar, bool bIgnoreLoad) const
{
[COLOR="red"]PROFILE_FUNC();[/COLOR]