Manco Capac
Friday,13 June,I Collapse
- Joined
- Mar 1, 2010
- Messages
- 8,051
Getting a tired to search this specific diploevent for days, I'll call the help of people here. 
What I'm trying to see is how it affects AI stacks to target cities. What kind of trajectory/generatepath function does it use to get to the targeted city.
First, the diploevent is in CvPlayer.cpp indeed.
I looked into CvArea.cpp
Sadly, I hit a dead end for my abilities. I don't see any reference on how units will move to get to the target city. Will it ignore passing cities in their route? Will they attack everything meanwhile because the stack is not really set to lemming type of behaviour?
I can't envision anything with what I got on hands right now.
=======================================================
Personal edits:

What I'm trying to see is how it affects AI stacks to target cities. What kind of trajectory/generatepath function does it use to get to the targeted city.
First, the diploevent is in CvPlayer.cpp indeed.
Code:
void CvPlayer::handleDiploEvent(DiploEventTypes eDiploEvent, PlayerTypes ePlayer, int iData1, int iData2)
{
CivicTypes* paeNewCivics;
CvCity* pCity;
int iI;
FAssertMsg(ePlayer != getID(), "shouldn't call this function on ourselves");
switch (eDiploEvent)
{
[...]
case DIPLOEVENT_TARGET_CITY:
pCity = GET_PLAYER((PlayerTypes)iData1).getCity(iData2);
if (pCity != NULL)
{
pCity->area()->setTargetCity(getID(), pCity);
}
break;
default:
FAssert(false);
break;
}
}
I looked into CvArea.cpp
Code:
void CvArea::setTargetCity(PlayerTypes eIndex, CvCity* pNewValue)
{
FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be < MAX_PLAYERS");
if (pNewValue != NULL)
{
m_aTargetCities[eIndex] = pNewValue->getIDInfo();
}
else
{
m_aTargetCities[eIndex].reset();
}
}
Sadly, I hit a dead end for my abilities. I don't see any reference on how units will move to get to the target city. Will it ignore passing cities in their route? Will they attack everything meanwhile because the stack is not really set to lemming type of behaviour?
I can't envision anything with what I got on hands right now.

=======================================================
Personal edits:
Code:
CvCity* CvArea::getTargetCity(PlayerTypes eIndex) const
{
FAssertMsg(eIndex >= 0, "eIndex is expected to be >= 0");
FAssertMsg(eIndex < MAX_PLAYERS, "eIndex is expected to be < MAX_PLAYERS");
return getCity(m_aTargetCities[eIndex]);
}
Code:
CyCity* CyArea::getTargetCity(int /*PlayerTypes*/ eIndex)
{
return m_pArea ? new CyCity(m_pArea->getTargetCity((PlayerTypes) eIndex)) : NULL;
}