Re: [Widelands-dev] [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(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. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/ferry into lp:widelands
For ships the single ship is enough to attend all ports, with ferries it is the opposite, you need the same number of ferries as waterroads. It would be convenient if AI can built "virtual roads" - from flag to flag, but if crossing the water this virtual road would break down into 3 roads - 2x actual roads and one waterroad. But this is more coding and bigger complexity -- https://code.launchpad.net/~widelands-dev/widelands/ferry/+merge/351880 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/ferry. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/ferry into lp:widelands
Is there any function that returns number of ferries for a player or Fleet? Also I presume there is a way how to query the waterroad if it has a ferry... -- https://code.launchpad.net/~widelands-dev/widelands/ferry/+merge/351880 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/ferry. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/ferry into lp:widelands
To get all ferries in a fleet: Waterway::get_fleet() or Ferry::get_fleet() FerryFleet::count_ferries() Counting stuff per player should not be needed, count per FerryFleet instead. I´ll add some functions to query a waterway whether it has a ferry, and to query the fleet how many waterways are unemployed. Btw, the FerryFleet does not keep a list of all waterways that belong to it. They are remembered only while they need a ferry; when they get one, the ferryfleet forgets that waterway. -- https://code.launchpad.net/~widelands-dev/widelands/ferry/+merge/351880 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/ferry. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/ferry into lp:widelands
And is there any link between ferryyard and a fleet? Can I query the waterroad if if has a ferryyard to provide it with ferry? -- https://code.launchpad.net/~widelands-dev/widelands/ferry/+merge/351880 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/ferry. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/ferry into lp:widelands
No, because it can be close to several unconnected oceans, just like a shipyard. You could keep a list of all ferry-reachable fields within the workarea of a ferry yard (*), and then check for a given waterway whether a CheckStepFerry-approved path exists from any node on the waterway to any of these fields. (* this is actually an incorrect approximation in some corner cases but that shouldn´t matter normally) -- https://code.launchpad.net/~widelands-dev/widelands/ferry/+merge/351880 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/ferry. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/ferry into lp:widelands
AI currently is not able to cope with multiple oceans in the case of ships, just to remind this fact... -- https://code.launchpad.net/~widelands-dev/widelands/ferry/+merge/351880 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/ferry. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/ai_flag_warehouse_distance into lp:widelands
Sorry overlooked you already did the merge. Seems as if Bunnybot is down again. -- https://code.launchpad.net/~widelands-dev/widelands/ai_flag_warehouse_distance/+merge/368544 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/ai_flag_warehouse_distance into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp