Ticket #48964

Units with (moves_left < 1) can't EMBARK in some rulesets

Open Date: 2024-01-18 01:13 Last Update: 2024-01-18 02:14

Reporter:
Owner:
(None)
Type:
Status:
Open
Component:
(None)
MileStone:
(None)
Priority:
5 - Medium
Severity:
5 - Medium
Resolution:
None
File:
None

Details

(Please disregard if upstream has made major recent changes to how TRANSPORT_EMBARK is executed, and accept my apologies.)

To recreate the issue, set a req that ACTION_TRANSPORT_BOARD requires the unit to have moves_left, then take a unit with <1 moves_left and embark to adjacent tile.

If land unit embarking to water, it will move to the water tile but then be unable to embark because ACTION_TRANSPORT_EMBARK is a pseudo-action that really does a dual action of order_move then order_board. So it will be left drowning in the water. But in all cases it will move to the tile but then not board.

The bugged code also assumed order_board will always be legal on the transport's tile in all cases where embark was legal from the adjacent tile (conceivably not the case in some theoretic rulesets.) Theoretic ruleset example: you need to be on a special space-dock infra tile to embark on a spaceship, but the spaceship is only pulled along-side this orbital docking satellite.)

At FCW, transport embark ultimately calls unit_move with emark_to punit pointer parameter, then ultimately arrives at a line of code like if (ptransporter) {

unit_transport_load_tp_status(punit, ptransporter, FALSE);

Changing FALSE to TRUE changes the bool parameter 'force' to enact the boarding no matter what, and this fixed the bug for us at FCW. To me this made sense because once the unit moves to the transport's tile, it represents a "promise" that is executing the order TRANSPORT_EMBARK which was already legally represented to the user as a valid action they could do with the DO-click-tile popup menu.

Ticket History (2/2 Histories)

2024-01-18 01:13 Updated by: lexxie9952
  • New Ticket "Units with (moves_left < 1) can't EMBARK in some rulesets" created
2024-01-18 02:14 Updated by: cazfi
Comment

As already discussed in https://forum.freeciv.org/f/viewtopic.php?t=94686, it's not an "dual action", nor can I reproduce the issue (with current freeciv)

Attachment File List

No attachments

Edit

Please login to add comment to this ticket » Login