Follow-up Comment #4, patch #3804 (project freeciv):
Yes, more abstraction makes sense, and certainly expands the range of what
ruleset authors would be able to do. is_flying_unit() and
is_flying_unit_class() are clearly not in the spirit of gen_move.
dai_choose_attacker_air() would need to return to the prior state, but that
entire AI module needs work for better abstraction of unit types. Units could
have bv_unit_class embarks, disembarks which would be checked in
could_unit_load() and can_unit_unload() if ptrans was UCF_UNREACHABLE.
wipe_unit() would allow units that can disembark on the location to try to
board other transport (assuming they may) if they cannot exist at the tile,
and kill/teleport other units.
Unfortunately, without the certain knowledge that the model is of vertical
separation with only intervening air, this isn't enough. The Alien ruleset
(and potential extensions thereto) provides a nice example for discussion
purposes. Consider the case of a Burrowing unit with disembarks including
Antigravity disembarking over a Burrow Tube: should this unit survive because
it is disembarking on a native road, or die because there is an Ocean or
Boiling Ocean between the transporter and the road? Alternately, consider the
case of a Native unit with disembarks including Burrowing and embarks
including Antigravity disembarking from a Burrow Tube and boarding the
Antigravity unit (given !can_exist_at_tile(), this can only happen if the
Burrowing transporter is processed by wipe_unit()).
So, to complete an abstract implementation, there needs to be a way to
know if any other restrictions apply to embark/disembark situations
(especially in cases where a unit is being rescued after loss of transport).
If all bases are assumed to be at ground level (and so REACHABLE), and
RF_UNREACHABLE is defined as an additional consideration (potentially to be
used for artifacts like Burrow Tubes), it may be possible to answer the
preceeding questions, but it may cause other issues (an Amphibious unit would
no longer be capable of disembarking from Burrowing units in a Burrow Tube).
Given an even more complex scenario, this may be considerably more
complicated. Further, depending on how the ability to embark/disembark is
conceived/described in the helptext, this may be imagined to be a once per
turn operation: performing two *different* such operations in a single turn
may be incompatible with the intent of a ruleset author.
More potential cases for consideration and/or suggestions for
implementation details to cover corner cases are very welcome.
Reply to this item at:
Message sent via/by Gna!
Freeciv-dev mailing list