← Back to team overview

widelands-dev team mailing list archive

Re: [Merge] lp:~widelands-dev/widelands/ferry into lp:widelands

 

Whether waterways/ferries are enabled can be checked as 
  map.get_waterway_max_length() >= 2
Typically, they are enabled only on maps where they make sense. Waterways have a maximum length that is map-dependent. 
If two flags can be connected both by a new road and by a new waterway, the AI should build a waterway only if a road connection is much much longer. Building waterways if a road is also possible nearby makes sense in a handful of corner cases but not in the majority of cases.
Also, if there are two flags with the same ware economy but different worker economies, the AI should try very hard to connect them with a normal road if somehow possible.

> It would be nice if the ferries were per economy

Completely impossible, sorry. A ferry can be sent to any waterway that is in the same FerryFleet as itself – and there can be multiple economies adjacent to the same ocean (not to mention that each economy can be adjacent to multiple oceans). Per-economy distribution (or bookkeeping) of ferries is just not possible.

> and AI would know in advance if the waterroad will be supplied by a ferry immediately

You could either
– Build the waterway; some 10 seconds later query its fleet whether a ferry is coming, and if not, destroy the new waterway and remember not to retry for some time.
– Or if you really want to check before you build a waterway: Check out FerryFleet::find_other_fleet, and copy the pathfinding code from there to obtain the ferryfleet that belongs to the ocean you are interested in; then you can query that fleet for unoccupied ferries.

-- 
https://code.launchpad.net/~widelands-dev/widelands/ferry/+merge/351880
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/ferry.


References