← Back to team overview

widelands-dev team mailing list archive

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

 

Launchpad limits the diff preview to the first 5000 lines. The other >9000 lines remain hidden…

A MOVECAPS_FERRY is not possible. For MOVECAPS_WALK and MOVECAPS_SWIM, you always know that if two adjacent nodes both have this movecap, a bob that also has that movecap can pass directly from one node to the other. For ferries, it is possible that a waterway may pass both of two adjacent nodes, but it might not be allowed to go directly from the one to the other. They might even be in different oceans. Imagine e.g. situation with two lakes separated by a 1-tile-wide strip of land. If you want to check whether a spot is suited for waterways at all, always use CheckStepFerry::reachable_dest.

The equivalent of the function you linked is easily possible. Instead of plain CheckStepRoad, use this:
Widelands::CheckStepAnd cstep;
cstep.add(Widelands::CheckStepFerry(egbase()));
cstep.add(Widelands::CheckStepRoad(player, Widelands::MOVECAPS_SWIM | Widelands::MOVECAPS_WALK));

Also note that in lines like
if (dynamic_cast<const Road*>(map[reachable_coords].get_immovable())) {
Road should be replaces by RoadBase (the superclass of Road and Waterway).
Also keep in mind that waterways can transport only wares, no workers. The AI should build one between two flags only if they belong to the same worker economy, or if their respective worker economies both are "functional" (i.e. have a warehouse). Just so it doesn´t build a constructionsite on an unreachable shore – a road is still needed so a builder can come.

You need to build one ferry yard per Ferry Ocean, just as you need one shipyard per Ship Ocean. Ferries can use every path that is also suited for ships plus narrow channels where ships can´t pass, so a ferry ocean tends to encompass more places than a ship ocean. Ferries are implemented similar to ships, they´ll swim around idly until assigned to a waterway, then they swim to it autonomously.

And it´s not that much additional management that´s needed (less than e.g. for ports and ships), it only seems so because the concept is so different ;)
-- 
https://code.launchpad.net/~widelands-dev/widelands/ferry/+merge/351880
Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/ferry.


References