Bouncing units and alliance break
Posted: Tue Jun 30, 2020 12:44 am
I'm trying to understand, how stack conflicts are resolved in case of unit being transported on allied ships, while alliance was broken.
There are two functions (freeciv 2.6) in server/unittools.c: throw_units_from_illegal_cities and resolve_stack_conflicts.
First function is using unit_transport_unload_send to handle units on transports, while second units is using bounce_unit function,
which move unit at no movement points cost.
If second function is called for units outside cities, there are at least 3 exploits possible:
1. teleport unit from land tile to adjacent land tile at no mp cost
2. unload any unit from transport at no mp cost - this unit can attack instantly, in same turn
3. unload unit, which is not provided for unloading (no disembark flag for unreachable transport).
Is it possible to fix above exploits by:
a) changing unit_move(punit, ptile, 0, NULL) to unit_move(punit, ptile, punit->moves_left, NULL)
b) adding iteration of unit unloading inresolve_stack_conflicts, similar to throw_units_from_illegal_cities?
There are two functions (freeciv 2.6) in server/unittools.c: throw_units_from_illegal_cities and resolve_stack_conflicts.
First function is using unit_transport_unload_send to handle units on transports, while second units is using bounce_unit function,
which move unit at no movement points cost.
If second function is called for units outside cities, there are at least 3 exploits possible:
1. teleport unit from land tile to adjacent land tile at no mp cost
2. unload any unit from transport at no mp cost - this unit can attack instantly, in same turn
3. unload unit, which is not provided for unloading (no disembark flag for unreachable transport).
Is it possible to fix above exploits by:
a) changing unit_move(punit, ptile, 0, NULL) to unit_move(punit, ptile, punit->moves_left, NULL)
b) adding iteration of unit unloading inresolve_stack_conflicts, similar to throw_units_from_illegal_cities?