Privateers beginning their move inside a friendly city trigger "Declare war popup"

Pep

King
Joined
May 28, 2002
Messages
688
Location
Spain
I have seen the following bug: if you select a privateer that is docked in a city and then you attempt to move it to a tile owned by a civilization to whom you haven't signed an open borders treaty, a "Declare war popup" appears. It doesn't happen when the privateer begins its movement outside the city.

Caravels and submarines which begin their movement inside a city doesn't trigger the "declare war" popup.

It's a minor one bug, as you can move your privateer 1 tile from your city and then move it into enemy territory. Except if your city is completely surrounded by enemy sea tiles, of course :lol:
 
I think I have found the code that produces the bug:

The function:
bool CvUnit::canEnterTerritory(TeamTypes eTeam, bool bIgnoreRightOfPassage)
returns true when the unit is a privateer and
bool CvUnit::isAlwaysHostile(const CvPlot* pPlot)
returns true.

"isAlwaysHostile" returns false when the privateer is in a city and true otherwise, and that is why the "Declare war" popup appears...

I think the bug can be resolved by making canEnterTerritory to return true when getUnitInfo().isHiddenNationality() is true (which happens with privateers units).
 
Top Bottom