Ticket #42600

Strict coast ships can't enter tiny island cities

Open Date: 2021-07-06 17:17 Last Update: 2021-09-29 00:37

Reporter:
Owner:
Type:
Status:
Closed
Component:
MileStone:
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
Fixed
File:
3

Details

Photo of a boat unit who is unable to enter a tiny island city. https://cdn.discordapp.com/attachments/358555060382203905/861719109272207380/unknown.png

blamed: map.c:is_safe_ocean() and/or the conditional logic in the 3 places in movement.c which include is_safe_ocean in a conditional logic expression

Ticket History (3/11 Histories)

2021-07-06 17:17 Updated by: lexxie9952
  • New Ticket "Strict coast ships can't enter tiny island cities" created
2021-07-07 02:40 Updated by: ihnatus
Comment

Yes, there is an omission dating back to long ago ("Trireme" flag in 2.6, "CoastStrict" later) that a coast strict unit tests adjacent tiles for being a safe coast but not its own one, so on a one-tile safe coast region it is illegal even if the terrain is safe coast itself and/or city. Even if we test the unit's tile for safe coast, btw, such a unit won't be able to exist in an oceanic city not adjacent to a safe coast, even if it is able to exist on adjacent tiles; that looks like also a bug.

2021-09-22 05:53 Updated by: cazfi
Comment

Reply To ihnatus

Even if we test the unit's tile for safe coast, btw, such a unit won't be able to exist in an oceanic city not adjacent to a safe coast, even if it is able to exist on adjacent tiles; that looks like also a bug.

Reading the code, I don't see the same problem with these as with moving to a tile. Related functions check for a safe city's existence *before* considering if unit is a CoastStrict unit outside safe coast.

2021-09-22 06:04 Updated by: cazfi
  • Resolution Update from None to Accepted
  • Milestone Update from (None) to 2.6.6
2021-09-22 06:05 Updated by: cazfi
  • Component Update from (None) to General
2021-09-23 13:27 Updated by: None
Comment

Wow that was easy. Thanks.

I was checking around and found this in movement.c, bool can_exist_at_tile(...) ...

/* UTYF_COAST_STRICT unit cannot exist in an ocean tile without access to land. */ if (utype_has_flag(utype, UTYF_COAST_STRICT)
&& !is_safe_ocean(nmap, ptile)) {
return FALSE;
}

Maybe a dumb question but would this also need a "&& !pcity" condition in there too?

2021-09-25 10:03 Updated by: cazfi
Comment

Reply To (Anonymous)

Wow that was easy. Thanks. I was checking around and found this in movement.c, bool can_exist_at_tile(...) ... /* UTYF_COAST_STRICT unit cannot exist in an ocean tile without access to land. */ if (utype_has_flag(utype, UTYF_COAST_STRICT) && !is_safe_ocean(nmap, ptile)) { return FALSE; } Maybe a dumb question but would this also need a "&& !pcity" condition in there too?

I think that if there's a relevant city, the function has returned already, and execution never even reach that code.
2021-09-29 00:37 Updated by: cazfi
  • Status Update from Open to Closed
  • Owner Update from (None) to cazfi
  • Resolution Update from Accepted to Fixed

Edit

You are not logged in. I you are not logged in, your comment will be treated as an anonymous post. » Login