Follow-up Comment #4, patch #4648 (project freeciv): Heh. That's one of the hardest ones (although some stuff, like hunter selection needs some refactoring). I've looked at this some, and have some ideas, but haven't finished plumbing the depths (I've been cutting off the smaller pieces from my list of uses of UMT_*, is_foo_unit{type}(), and move_type first). Some of my thoughts include:
dai_is_ferry_type() This should test 1) whether it can transport units to terrains that they otherwise could not reach and 2) whether it can transport fueled units. It is probably worth constructing a ferry cache at ruleset load time, rather than iterating repeatedly for these tests. kill_something_with() This should consider requesting a ferry when the unit can't get to the destination, rather than fussing with continent IDs and move_type. process_attacker_want() This needs deeper analysis comparing the land and sea sides, but the needferry cost should be determined by using pathfinding to see if the unit can get to a potential destination, rather than as a blanket test. (the "terrible yoyo bug" is probably best addressed by considering CAN_OCCUPY and current enemy city defender count, while playing with this). military_advisor_choose_build() This should select potential ferries based on ability to transport considered unit and ability of the ferry to get somewhere interesting with the unit. The big ugly bit is the ferry pathfinding stuff, which is scattered between aiferry.c, aitools.c, and pf_tools.c. I haven't unwound all of this yet, but suspect that there exists some sensible method to handle it with consideration for complex nativity. Essentially, rather than considering amphibiousness, we want to consider whether it is possible for a unit to get from A to B without help, and whether it is faster for a unit to get from A to B with help. "Beachhead" becomes a poor term, but the idea is the same: if one has a "Big Land" armoured troop transport (move_rate=3) that carries "Land", it may be interesting for a Riflemen to take a ride for a while, then get dropped off to climb some mountains and take a defensive stance. Yes, this is hard, and yes it requires testing, but it *can* be autogame tested (well, most things: I missed something with only autogame testing patch #3901, which wasn't caught until I was testing with a client, and ferry pathfinding also hits the common pathfinding code). I'm less confident of our ability to meaningfully test the interface changes associated with the client code adjustments. _______________________________________________________ Reply to this item at: <http://gna.org/patch/?4648> _______________________________________________ Message sent via/by Gna! http://gna.org/ _______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev