Ticket #42600

Strict coast ships can't enter tiny island cities

Eröffnet am: 2021-07-06 17:17 Letztes Update: 2021-09-29 00:37

Auswertung:
Verantwortlicher:
Typ:
Status:
Geschlossen
Komponente:
Meilenstein:
Priorität:
5 - Mittel
Schweregrad:
5 - Mittel
Lösung:
Gefixt
Datei:
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-Verlauf (3/11 Historien)

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

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 Aktualisiert von: cazfi
Kommentar

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 Aktualisiert von: cazfi
  • Lösung Update from Keine to Accepted
  • Meilenstein Update from (Keine) to 2.6.6 (closed)
2021-09-22 06:05 Aktualisiert von: cazfi
  • Komponente Update from (Keine) to General
2021-09-23 13:27 Aktualisiert von: None
Kommentar

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 Aktualisiert von: cazfi
Kommentar

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 Aktualisiert von: cazfi
  • Status Update from Offen to Geschlossen
  • Verantwortlicher Update from (Keine) to cazfi
  • Lösung Update from Accepted to Gefixt

Bearbeiten

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