Unit unable to attack city

Deliverator

Graphical Hackificator
Joined
Feb 12, 2008
Messages
4,813
Location
London, UK
We have a problem in Dune Wars where units with DOMAIN_SEA and bCanMoveAllTerrain set to 1 are unable to attack cities. In an earlier version of Dune Wars they could, but since we have merged in more recent version of RevDCM, Better BTS AI and BUG this has broken.

I am trying to track down the code that could be causing this. I initially thought that that it must be something in CvUnit:canMoveInto, but when I stubbed out that function to always return true, the units in question where still unable to attack cities. Can anyone point me to some other code that might be affecting this?
 
Further diagnosis: The units in question cannot even enter an undefended enemy city.
 
I've resolved this now. See here. It was basically because some important code relating to all terrain vehicles and amphibious attacks got merged out at some point.
 
Does the unit in question have a combat limit < 100? I noticed the following code in CvUnit::canAttack.

Code:
    // Artillery can't amphibious attack
    if (plot()->isWater() && !defender.plot()->isWater())
    {
        if (combatLimit() < 100)
        {
            return false;
        }
    }

I'm not sure if canAttack would apply to entering undefended cities, but if it does, this could be your problem.

Edit: Never mind, I see that you already solved your problem.
 
Back
Top Bottom