Pep
Aug 11, 2008, 05:04 PM
In the attached image, the naval group (on sentry mission) doesn't awake when a barbarian warrior enters the red spot on the following turn. If you disband the galleon and then sentry the privateers, they do awake at the next turn. This is because the privateers have an extended visibility radius (as they start with the sentry promotion while the galleon doesn't). I think the visibility radius of a group when on a sentry mission, should be the highest of the visibility radius of the units that form the group.
You can open the savegame and test it too.
Pep
Aug 11, 2008, 05:11 PM
To correct this bug, I think the beginning of the function CvSelectionGroup::sentryAlert() could be modified:
from:
bool CvSelectionGroup::sentryAlert() const
{
int iMaxRange = 0;
CLLNode<IDInfo>* pUnitNode = headUnitNode();
while (pUnitNode != NULL)
{
CvUnit* pLoopUnit = ::getUnit(pUnitNode->m_data);
pUnitNode = nextUnitNode(pUnitNode);
int iRange = pLoopUnit->visibilityRange() + 1;
if (iRange > iMaxRange)
{
iMaxRange = iRange;
}
}
CvUnit* pHeadUnit = getHeadUnit();
...
to:
bool CvSelectionGroup::sentryAlert() const
{
int iMaxRange = 0;
CLLNode<IDInfo>* pUnitNode = headUnitNode();
int iIndex = -1;
while (pUnitNode != NULL)
{
CvUnit* pLoopUnit = ::getUnit(pUnitNode->m_data);
pUnitNode = nextUnitNode(pUnitNode);
int iRange = pLoopUnit->visibilityRange() + 1;
if (iRange > iMaxRange)
{
iMaxRange = iRange;
iIndex = getUnitIndex(pLoopUnit);
}
}
CvUnit* pHeadUnit = ((iIndex == -1) ? NULL : getUnitAt(iIndex));
...