@3Miro, do you kow how the warmaps work exactly?
I was very puzzled today when i played as Germany. The norse launched a succesfull surprise attack at my city of Luebeck. I had no time to reinforce my troops so i evacuated the city. The norse walked up to the city and then waited there and waited and waited, for turns, they did not attack the city plot, however they attacked my units outside of the city.
I opened the worldbuilder and changed the UnitAI of some units from UNITAI_COUNTER to UNITAI_ATTACK to UNITAI_ATTACK_CITY, i moved some units in and out trying to make some easy targets inside the city. And then at some point they finally attacked.
I thought it has something to do with the warmaps. So i looked into the reference folder and yes, Luebeck is not in the warmap of the Norse. I also looked into RFCEMaps.py to confirm this, because the reference folder is not always up to date.
Then i looked into the c-code to see how those warmaps work. They are only used in the CvUnitAI.cpp and there is a always a comment that says something like "ignore Barb/indy cities outside the war map"
But it appears to me that it does not only affect barb and indy cities but all cities of every player. Everytime a unit tries to attack a plot that has a city on it, a check is made if the city is on the warmap, and if not, the unit does not attack. However if the plot has no city the warmaps seem to be ignored. (see code below)
That means the safest place is inside a city that is outside the warmap of your enemy.
That seems not to be the way it was intended.
Maybe i got it wrong, but then how do the warmaps work?
I also thought that warmaps had different gradients/increments as the different colora in the wamapa suggest, but the color seems to make no difference. It only checkes if the tile has a value greater than zero.
Apperantly there are some holes, not everywhere in the code the check for the warmaps is made. Because eventually the norse captured my city, and some people reported about barb cities that were captured outside of warmaps.
Code:
CvUnitAI::AI_cityAttack or CvUnitAI::AI_anyAttack
[...]
//loop over some plots
if ( pLoopPlot ->isCity() ) {
if ( getOwnerINLINE() < NUM_MAJOR_PLAYERS ){ //we check if the owner of the unit has a warmap?
if (warsMaps[getOwnerINLINE() ...] == 0 ) {
//ignore plot
};
};
};