Having got the hang of the XML part of modding, I'm now trying to break into the SDK and could do with some help
What I want to do in my mod is to remove Air units and Sea units ability to base in forts but keep the fort's, control of resource's ability (the bActAsCity tag).
Instead make an Airbase improvement for Air Units to base on and also make it so that Paradrops can be made from airbases as well as friendly cities.
I created an Airbase and a bAirbase XML tag for the ImprovementInfos.xml, did the schema and did the sdk bAirbase entries in CVinfos.cpp and h and that compressess ok.
Now the problem is to find out how to use it to allow air units to base on the new improvement and paradrops to be made.
In CvUnit, in the function "CvUnit::canParadrop" there's this code
So I've tried adding lots of code to it to say-if not isAirbase return false-as well. Like....
doesn't work, it throws up these errors.
I put code in cvPlot.cpp (trying to follow examples in Chinese American's More Trade Routes modpack) to reference it like below, with no success, so any ideas anyone?
Like I say I'm fumbling in the dark here so any light on the problem would be cool. Thanks
This is the code in cvPlot.cpp for isActsAsCity and isFriendlyCity
What I want to do in my mod is to remove Air units and Sea units ability to base in forts but keep the fort's, control of resource's ability (the bActAsCity tag).
Instead make an Airbase improvement for Air Units to base on and also make it so that Paradrops can be made from airbases as well as friendly cities.
I created an Airbase and a bAirbase XML tag for the ImprovementInfos.xml, did the schema and did the sdk bAirbase entries in CVinfos.cpp and h and that compressess ok.
Now the problem is to find out how to use it to allow air units to base on the new improvement and paradrops to be made.
In CvUnit, in the function "CvUnit::canParadrop" there's this code
Code:
if (!pPlot->isFriendlyCity(*this, true))
{
return false;
}
Code:
if (GC.getImprovementInfo(eImprovement).isAirbase())
{
if (!isAirbase())
{
return false;
}
}
}
So I guess I'm missing something somewhere but I don't know what.'eImprovement' : undeclared identifier|
left of '.isAirbase' must have class/struct/union type|
'isAirbase': identifier not found, even with argument-dependent lookup|
I put code in cvPlot.cpp (trying to follow examples in Chinese American's More Trade Routes modpack) to reference it like below, with no success, so any ideas anyone?
Like I say I'm fumbling in the dark here so any light on the problem would be cool. Thanks
This is the code in cvPlot.cpp for isActsAsCity and isFriendlyCity
Code:
bool CvPlot::isCity(bool bCheckImprovement, TeamTypes eForTeam) const
{
if (bCheckImprovement && NO_IMPROVEMENT != getImprovementType())
{
if (GC.getImprovementInfo(getImprovementType()).isActsAsCity())
{
if (NO_TEAM == eForTeam || (NO_TEAM == getTeam() && GC.getImprovementInfo(getImprovementType()).isOutsideBorders()) || GET_TEAM(eForTeam).isFriendlyTerritory(getTeam()))
{
return true;
}
}
}
return (getPlotCity() != NULL);
}
bool CvPlot::isFriendlyCity(const CvUnit& kUnit, bool bCheckImprovement) const
{
if (!isCity(bCheckImprovement, kUnit.getTeam()))
{
return false;
}
if (isVisibleEnemyUnit(&kUnit))
{
return false;
}
TeamTypes ePlotTeam = getTeam();
if (NO_TEAM != ePlotTeam)
{
if (kUnit.isEnemy(ePlotTeam))
{
return false;
}
TeamTypes eTeam = GET_PLAYER(kUnit.getCombatOwner(ePlotTeam, this)).getTeam();
if (eTeam == ePlotTeam)
{
return true;
}
if (GET_TEAM(eTeam).isOpenBorders(ePlotTeam))
{
return true;
}
if (GET_TEAM(ePlotTeam).isVassal(eTeam))
{
return true;
}
}
return false;
}