Privateer style land unit, can enter enemy cities

peter450

Prince
Joined
Sep 24, 2006
Messages
392
I know the old privateer had a bug (since patched) were it could enter other civilizations cities even though it's considered always hostile

I made a privateer land unit and it has the same problem were if your not at war and go to a rival city you can just move inside

How do i prevent the unit from entering cities at all? anyone know what changes were made to the privateer to fix that bug?

Not an easy question i know, but i'm stumped for what to do
 
I don't know how the privateer issue was fixed ... isAlwaysHostile isn't used in too many places.

To fix this yourself, the function you want is CvUnit::canMoveInto ... there, you'd want to add something like:

Code:
if( isAlwaysHostile() )
{
    if( pPlot->isCity(true, getTeam()) && pPlot->getTeam() != getTeam() )
    {
         return false;
    }
}

Probably put that around where the isNoCapture() line is I think, not that it matters really where you put it.
 
Being a complete python novice, which python file would i stick that into? and would i just cut and paste it anywere into the file or would i need to add any extra text?
 
Uhh ... what I wrote was for the SDK.

It's possible to do in Python, you'll need to set USE_UNIT_CANNOT_MOVE_INTO_CALLBACK to true and then put something similar to the above into a Python callback function called unitCannotMoveInto in CvGameInterface.py ... look around on the forums for info on how to use the Python callback functions, I'm sure someone's got a tutorial. The code will have to be Pythonified ...
 
Back
Top Bottom