trireme on land exploit

What would you like to see in Freeciv? Do you have a good idea what should be improved or how?
Wahazar
Hardened
Posts: 201
Joined: Mon Jul 02, 2018 1:49 pm

Re: trireme on land exploit

Postby Wahazar » Mon Jan 14, 2019 12:50 am

Well, lets summarize to clear possible misunderstanding.
    There can be following cases:
  • ship with land units on ocean: attacked is ship, if die, land units die - it is normal behavior.
  • ship with air units on ocean: attacked is ship, but air units survive - it is weird behavior.
  • ship with land units on river: is treated like a normal stack (best defender is attacked) but this stack is not visible for attacker. Moreover, loaded units can be fortified. Very weird and unfair behavior.
The second case seems to be effect of code wipe out units, which can't survive - it is in version 2.5, but can't find it in current branch - it was fixed?
I also don't understand, where the third case is coded.
I found unit_attack_any_at_tile_result function in common/combat.c where transported units are excluded from being taken into attack consideration.

cazfi
Elite
Posts: 1701
Joined: Tue Jan 29, 2013 6:54 pm

Re: trireme on land exploit

Postby cazfi » Mon Jan 14, 2019 1:53 am

Wahazar wrote:* ship with land units on river: is treated like a normal stack (best defender is attacked) but this stack is not visible for attacker. Moreover, loaded units can be fortified. Very weird and unfair behavior.
...
I also don't understand, where the third case is coded.


unit_can_defend_here():

Code: Select all

  /* Do not just check if unit is transported.
   * Even transported units may step out from transport to fight,
   * if this is their native terrain. */
  return (can_unit_exist_at_tile(punit, unit_tile(punit))
          && (ptrans == NULL || can_unit_unload(punit, ptrans)));

Wahazar
Hardened
Posts: 201
Joined: Mon Jul 02, 2018 1:49 pm

Re: trireme on land exploit

Postby Wahazar » Mon Jan 14, 2019 2:02 am

Thanks, so it is intended behavior. I always unloaded units from trireme between turns, to avoid its lost.
I understand, that this hack is to avoid such unloading/loading units manually - unfortunately this implementation is debatable.
It is unfair that player didn't see stack, but must to fight with it, and that it is possible to fortify inside boat.
Either stack should to be visible, or just behavior similar to carrier with airplanes should be applied (if you kill trireme on land, units inside can survive and you need to fight with them later).