View Full Version : Modify airport to only airlift to other cities with airports


troyDoogle7
Jan 08, 2007, 02:36 AM
I think its a lot more realistic, if you can airlift only to cities with Airports (plus it is a requirement for the psi-gate for our mod)

Can anyone help me work out how to do this?

PeteT
Jan 09, 2007, 03:03 PM
This little addition to the following method should do it:


bool CvUnit::canAirliftAt(const CvPlot* pPlot, int iX, int iY) const
{
CvPlot* pTargetPlot;
CvCity* pTargetCity;

if (!canAirlift(pPlot))
{
return false;
}

pTargetPlot = GC.getMapINLINE().plotINLINE(iX, iY);

if (!canMoveInto(pTargetPlot))
{
return false;
}

pTargetCity = pTargetPlot->getPlotCity();

if (pTargetCity == NULL)
{
return false;
}

if (pTargetCity->isAirliftTargeted())
{
return false;
}

if (pTargetCity->getTeam() != getTeam() && !GET_TEAM(pTargetCity->getTeam()).isVassal(getTeam()))
{
return false;
}

//destination city must have airport
if (pTargetCity->getMaxAirlift() == 0)
{
return false;
}

return true;
}