/* LPlate - Rings and Squares */
bool CvPlot::isRingsBonus(int iRange, bool bSquare, bool bIncludeSelf, int iOwnership, PlayerTypes ePlayer, bool bWorked, BonusTypes eType, bool bImproved) const
{
// bSquare: 0 = rings, 1 = squares
// iOwnership: 0 = Ownership is irrelevant,1 = Only owned by self, 2 = Not owned by someone else, 3 = Owned by someone else)
TeamTypes eTeam = GET_PLAYER(ePlayer).getTeam();
for (int iDX = -iRange; iDX <= iRange; iDX++)
{
for (int iDY = -iRange; iDY <= iRange; iDY++)
{
CvPlot* pLoopPlot = plotXY(getX_INLINE(), getY_INLINE(), iDX, iDY);
if (bSquare || (plotDistance(pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE(), getX_INLINE(), getY_INLINE()) <= iRange))
{
if(bIncludeSelf || (pLoopPlot->getX_INLINE() != getX_INLINE() || pLoopPlot->getY_INLINE() != getY_INLINE()))
{
if((iOwnership == 0) ||
(iOwnership == 1 && pLoopPlot->getOwnerINLINE() == ePlayer) ||
(iOwnership == 2 && (pLoopPlot->getOwnerINLINE() == ePlayer || (!(pLoopPlot->isOwned())))) ||
(iOwnership == 3 && (!(pLoopPlot->getOwnerINLINE() == ePlayer && (!(pLoopPlot->isOwned()))))))
{
if (!(bWorked) || pLoopPlot->isBeingWorked())
{
if (pLoopPlot->getBonusType() == eType)
{
if (!(bImproved) || pLoopPlot->getImprovementType() != NO_IMPROVEMENT)
{
if (!(bRevealed) || pLoopPlot->isRevealed(eTeam, false))
{
return true;
}
}
}
}
}
}
}
}
}
return false;
}
int CvPlot::getRingsBonus(int iRange, bool bSquare, bool bIncludeSelf, int iOwnership, PlayerTypes ePlayer, bool bWorked, BonusTypes eType, bool bImproved) const
{
// bSquare: 0 = rings, 1 = squares
// iOwnership: 0 = Ownership is irrelevant,1 = Only owned by self, 2 = Not owned by someone else, 3 = Owned by someone else)
int iCount = 0;
TeamTypes eTeam = GET_PLAYER(ePlayer).getTeam();
for (int iDX = -iRange; iDX <= iRange; iDX++)
{
for (int iDY = -iRange; iDY <= iRange; iDY++)
{
CvPlot* pLoopPlot = plotXY(getX_INLINE(), getY_INLINE(), iDX, iDY);
if (bSquare || (plotDistance(pLoopPlot->getX_INLINE(), pLoopPlot->getY_INLINE(), getX_INLINE(), getY_INLINE()) <= iRange))
{
if(bIncludeSelf || (pLoopPlot->getX_INLINE() != getX_INLINE() || pLoopPlot->getY_INLINE() != getY_INLINE()))
{
if((iOwnership == 0) ||
(iOwnership == 1 && pLoopPlot->getOwnerINLINE() == ePlayer) ||
(iOwnership == 2 && (pLoopPlot->getOwnerINLINE() == ePlayer || (!(pLoopPlot->isOwned())))) ||
(iOwnership == 3 && (!(pLoopPlot->getOwnerINLINE() == ePlayer && (!(pLoopPlot->isOwned()))))))
{
if (!(bWorked) || pLoopPlot->isBeingWorked())
{
if (pLoopPlot->getBonusType() == eType)
{
if (!(bImproved) || pLoopPlot->getImprovementType() != NO_IMPROVEMENT)
{
if (!(bRevealed) || pLoopPlot->isRevealed(eTeam, false))
{
iCount += 1;
}
}
}
}
}
}
}
}
}
return iCount;
}
/* End LPlate - Rings and Squares */