void CvTeam::testCircumnavigated()
{
CvPlot* pPlot;
CvWString szBuffer;
bool bFoundVisible;
int iX, iY;
if (isBarbarian())
{
return;
}
if (!GC.getGameINLINE().circumnavigationAvailable())
{
return;
}
if (GC.getMapINLINE().isWrapXINLINE())
{
for (iX = 0; iX < GC.getMapINLINE().getGridWidthINLINE(); iX++)
{
bFoundVisible = false;
for (iY = 0; iY < GC.getMapINLINE().getGridHeightINLINE(); iY++)
{
pPlot = GC.getMapINLINE().plotSorenINLINE(iX, iY);
if (pPlot->isRevealed(getID(), false))
{
bFoundVisible = true;
break;
}
}
if (!bFoundVisible)
{
return;
}
}
}
if (GC.getMapINLINE().isWrapYINLINE())
{
for (iY = 0; iY < GC.getMapINLINE().getGridHeightINLINE(); iY++)
{
bFoundVisible = false;
for (iX = 0; iX < GC.getMapINLINE().getGridWidthINLINE(); iX++)
{
pPlot = GC.getMapINLINE().plotSorenINLINE(iX, iY);
if (pPlot->isRevealed(getID(), false))
{
bFoundVisible = true;
break;
}
}
if (!bFoundVisible)
{
return;
}
}
}
GC.getGameINLINE().makeCircumnavigated();
if (GC.getGameINLINE().getElapsedGameTurns() > 0)
{
if (GC.getDefineINT("CIRCUMNAVIGATE_FREE_MOVES") != 0)
{
changeExtraMoves(DOMAIN_SEA, GC.getDefineINT("CIRCUMNAVIGATE_FREE_MOVES"));
for (int iI = 0; iI < MAX_PLAYERS; iI++)
{
if (GET_PLAYER((PlayerTypes)iI).isAlive())
{
if (getID() == GET_PLAYER((PlayerTypes)iI).getTeam())
{
szBuffer = gDLL->getText("TXT_KEY_MISC_YOU_CIRC_GLOBE", GC.getDefineINT("CIRCUMNAVIGATE_FREE_MOVES"));
}
else if (isHasMet(GET_PLAYER((PlayerTypes)iI).getTeam()))
{
szBuffer = gDLL->getText("TXT_KEY_MISC_SOMEONE_CIRC_GLOBE", getName().GetCString());
}
else
{
szBuffer = gDLL->getText("TXT_KEY_MISC_UNKNOWN_CIRC_GLOBE");
}
gDLL->getInterfaceIFace()->addMessage(((PlayerTypes)iI), false, GC.getEVENT_MESSAGE_TIME(), szBuffer, "AS2D_GLOBECIRCUMNAVIGATED", MESSAGE_TYPE_MAJOR_EVENT, NULL, (ColorTypes)GC.getInfoTypeForString("COLOR_HIGHLIGHT_TEXT"));
}
}
szBuffer = gDLL->getText("TXT_KEY_MISC_SOMEONE_CIRC_GLOBE", getName().GetCString());
GC.getGameINLINE().addReplayMessage(REPLAY_MESSAGE_MAJOR_EVENT, getLeaderID(), szBuffer, -1, -1, (ColorTypes)GC.getInfoTypeForString("COLOR_HIGHLIGHT_TEXT"));
}
}
}