a sample code of what?
If you downloaded SoI, it comes with full source code. To see how to set up areas, look at CvMap::calculateAreas, mine/Rhye's code is marked there. You can see most of it is commented out, because I disabled the division of Eurasia into Near East, Persia and India for the reasons given in my previous post. The remaining code simply turns parts of Arabian peninsula into islands, because they're effectively separated from rest of the continent by impassable desert:
Code:
CvArea* oman = addArea();
int omanID = oman->getID();
oman->init(omanID, false);
for (iX = 0; iX < EARTH_X; iX++)
{
gDLL->callUpdater();
for (iY = 0; iY < EARTH_Y; iY++)
{
if (regionMap[EARTH_Y -1 -iY][iX] == 30)
{
if (!plotSorenINLINE(iX, iY)->isWater())
plotSorenINLINE(iX, iY)->setArea(omanID);
}
}
}
EARTH_X and EARTH_Y are map size constants. regionMap you can check in CvRhyes.cpp, you don't have to use it, it's just my 2d array that divides the map into regions, and 30 is the code for Oman. Rhye just typed the coordinates manually. What the above does is that it creates a new area ID and then applies it to selected plots, turning them into a continent.
***
For how to deal with the AI values, just look at CvPlayerAI::AI_targetCityValue, in particular this part:
Code:
//Rhye - start
if (settlersMaps[getID()][EARTH_Y - 1 - pCity->plot()->getY_INLINE()][pCity->plot()->getX_INLINE()] <= 3)
iValue = iValue/3 - 4;
else if (settlersMaps[getID()][EARTH_Y - 1 - pCity->plot()->getY_INLINE()][pCity->plot()->getX_INLINE()] <= 20)
iValue -= 3;
else if (settlersMaps[getID()][EARTH_Y - 1 - pCity->plot()->getY_INLINE()][pCity->plot()->getX_INLINE()] >= 500) //500-700
iValue = 2 + iValue*3;
else if (settlersMaps[getID()][EARTH_Y - 1 - pCity->plot()->getY_INLINE()][pCity->plot()->getX_INLINE()] >= 300) //300-400
iValue = 2 + iValue*2;
else if (settlersMaps[getID()][EARTH_Y - 1 - pCity->plot()->getY_INLINE()][pCity->plot()->getX_INLINE()] >= 150) //150-200
iValue += 3;
else if (settlersMaps[getID()][EARTH_Y - 1 - pCity->plot()->getY_INLINE()][pCity->plot()->getX_INLINE()] >= 40) //40-60-90
iValue += 1;
settlersMaps is a 3d array... or an array of 2d map arrays... also found in CvRhyes.cpp
settlersMap[id][x][y] = value of the plot (x,y) for player with this id. Mind you, this is for a scenario so IDs are always the same.
the code above makes sure that if the value of a plot is high, i.e. 400, the AI should value it highly, and when it's very low, i.e. 3, the AI should think it's useless.
RFC is rather complicated... I'm not sure what are you trying to achieve, but a similar thing can be done with much less work and Python only, although it's a bit artificial - you can make sure that the AI periodically declares wars on specific targets that have cities or plots defined as lists or coord sets.