It wouldn't be too hard to implement option C, in CvCityAI::AI_playerCloseness we could change:
Code:
iTempValue = 20 + [B]pLoopCity->getPopulation() + getPopulation()[/B];
Thanks for your thoughts. Here are some of my own. I now am starting to think that the "human error" was that option B was intended let me explain.
Point 1:
The for-loop construction using the macro GET_PLAYER (thanks Yakk) is so common in the BTS code. The design of the function:
int CvPlayerAI::AI_playerCloseness(PlayerTypes eIndex, int iMaxDistance)
would surely have been intended utilising that standardised for-loop construction. I cannot imagine that all of the coders and quality control would have opted for the option A non-standard for loop construction. It just looks "different" and would have raised questions.
Point 2:
Because of point 1, the error has to be in the summing code inside that loop. The correct code by inference must be:
Code:
for (pLoopCity = GET_PLAYER(eIndex).firstCity(&iLoop); pLoopCity != NULL; pLoopCity = GET_PLAYER(eIndex).nextCity(&iLoop))
{
iValue += pLoopCity->AI_playerCloseness(this->getID(), iMaxDistance);
}
Point 3:
Assuming the correctness of point 1 and point 2, there is an over-arching "strategic" flavour to the whole issue of "closeness". If option A were correct, that is a tactical issue. In other words "can I capture a large ripe enemy target from my any size close city". That question is tactical because it depends on a matter of unit deployment. In the case of a war on another continent, it would be how many galleons full of invasion forces did I bring?
Point 4:
If point 3 is correct, option B is a strategic question in line with the flavour of the actual "closeness" code. In other words "can I capture any size enemy target city close to my integrated cities". It is strategic because "large numbers of tightly packed large cities" have automatic strategic defenses already in place usually with the capacity for attack as well. That would fit with the measure of strategic "closeness" to me as it is in the code right now.
Point 5:
Here are all the references to AI_playerCloseness that I can find:
A) int CvCityAI::AI_cityThreat(bool bDangerPercent)
Here it seems to be asking whether a "crush strategy" is possible (strategy not tactic).
B) void CvPlayerAI::AI_conquerCity(CvCity* pCity)
Here it seems to work out whether it is possible to raze a city from a "structural" perspective (strategy)
Code:
int iCloseness = pCity->AI_playerCloseness(getID());
if (iCloseness > 0)
{
iRazeValue -= 25;
iRazeValue -= iCloseness * 2;
}
C) int CvPlayerAI::AI_getStrategyHash()
Here it seems to be working out the strategic effect on diplomacy based on "closeness". All of these questions seem to be "strategic" not "tactical" to me.
As for Jdog's wonderfully simple idea, isn't it a fascinating though? What was really intended was not:
pLoopCity->getPopulation() * 2 (arbitrary short term fix looks to me!)
with:
pLoopCity->getPopulation() + getPopulation()! (yeah right on!???)
I would *love* to understand the effect of that simple alteration. Is it right and good or is it not? I can only look at the code and guess. I have no debugger yet. I find it hard work to deciphor the difference without practical experiment.
As Yakk said, there is a chance of "overkill". The option B fix looks to me to be a bug fix, while Jdog's suggestion looks to be a "better ai" fix. Maybe we should release dll's with the Option B fix combined with Jdog's two variations of the closeness equations so that people can try for themselves?
Cheers and thanks.