Afforess
The White Wizard
Thanks a ton! You'll definitely get credit for this!
bool CvPlayer::canFound(int iX, int iY, bool bTestVisible) const
{...
if (pPlot->isPeak())
{
if (GC.getGameINLINE().isOption(GAMEOPTION_MOUNTAINS))
{
if ((GET_TEAM(!GC.getGameINLINE().getActiveTeam()).isCanFoundOnPeaks()))
{
return false;
}
else
{
return true;
}
}
else
{
return false;
}
}
...
}
CvPlayer.cpp(6412) : error C2664: 'CvTeamAI::getTeam' : cannot convert parameter 1 from 'bool' to 'TeamTypes'
Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)
CvPlayer.cpp(6412) : error C2228: left of '.isCanFoundOnPeaks' must have class/struct/union type
if (!GET_TEAM(GC.getGameINLINE().getActiveTeam()).isCanFoundOnPeaks())
You've got a typo with your placement of the ! operator. You are !ing the active team ID. You want this:
I removed one level of outer parentheses because they were unnecessary. All you really need to do is move the ! to the left of GET_TEAM.Code:if (!GET_TEAM(GC.getGameINLINE().getActiveTeam()).isCanFoundOnPeaks())
if (pPlot->isImpassable(getTeam()))
if (!(isCanMovePeaks) || (pPlot->isImpassable(getTeam())))
error C2276: '!' : illegal operation on bound member function expression
if (!(isCanMovePeaks[B][COLOR="DarkOrange"]()[/COLOR][/B]) || (pPlot->isImpassable(getTeam())))
Is isCanMovePeaks a function on CvUnit? If so, you need to add ()s to call it:
Code:if (!(isCanMovePeaks[B][COLOR=DarkOrange]()[/COLOR][/B]) || (pPlot->isImpassable(getTeam())))
if (bRetreat)
{
if pPlot->isImpassable(getOwnerINLINE()) && isCanPassPeaks()
{
pUnitToHeal()->pushMission(MISSION_HEAL);
return true;
}
}
This part of the code (AI) is the area with which I am least familiar, but I would think you'd need to consider nearby units that can also pass peaks (i.e. pose a danger to the healing unit). Is there code in the AI that tells it to favor forest/jungle and/or hills when deciding where to heal/move? If so, I would expect that part of the code to be a good spot to include the check for peaks.
iValue += pLoopPlot->defenseModifier(getTeam(), false);
Check to make sure CvUnit::defenseModifier() doesn't ignore the modifier for peaks if the plot is impassible. If most rivals have the tech that allows peak passage, +100% should cover it. If most units still cannot pass through peaks, you should probably increase the safety value of the plot, but that's optional and a bit more fuzzy.
if (GC.getGameINLINE().isOption(GAMEOPTION_MOUNTAINS))
{
if (isPeak())
{
iModifier += GC.getPEAK_EXTRA_DEFENSE();
}
}
TechTypes CvPlayerAI::AI_bestTech(int iMaxPathLength, bool bIgnoreCost, bool bAsync, TechTypes eIgnoreTech, AdvisorTypes eIgnoreAdvisor) const
if (GC.getTechInfo((TechTypes)iI).isCanPassPeaks())
{
CvPlot* pLoopPlot = GC.getMapINLINE().plotByIndexINLINE(iI);
int PeaksInOurLand = 0;
for (iI = 0; iI < NUM_CITY_PLOTS_2; iI++)
{
if (pLoopPlot->isPeak())
{
PeaksInOurLand++;
}
}
iValue += ((PeaksInOurLand * 40) + 200);
}
if (GC.getPromotionInfo(ePromotion).isCanMovePeaks()) //Afforess
{
CvTeam& kTeam = GET_TEAM(getTeam());
for (iI = 0; iI < GC.getNumTechInfos(); iI++)
{
if (!(kTeam.isHasTech((TechTypes)iI))) //If we don't have the tech
{
if (GC.getTechInfo((TechTypes)iI).isCanPassPeaks()) //and the tech allows peak movements
{
iValue += 100; //then value this promotion alot. Otherwise, it's worthless.
}
}
}
}
int CvUnitAI::AI_promotionValue(PromotionTypes ePromotion)
int iPeakCount = 0;
for iK in total map tiles
plot = map.plot(iK)
if plot.isPeak() and plot.getOwnerINLINE() == getID()
++iPeakCount;
int iPeakCount = 0;
for city in player cities
for plot in city radious
if plot.isPeak() and plot.getOwnerINLINE() == getID()
++iPeakCount;
You are using iI (the loop tech ID) as if it were a plot index. What exactly are you hoping to do? If you want to count all peak tiles in the AI's land, loop over the whole map with a new loop counter (iJ, iK? whatever, just not something like iI that is already being used) and count the number of plots that a) are owned by the AI and b) are peaks.