pub fn steer(
path: &[Pos],
to: Pos,
cheapest: impl FnOnce(Pos) -> Option<Vec<Pos>>,
valid: impl Fn(&[Pos]) -> bool,
) -> Vec<Pos>Expand description
The path after the cursor moves to to. path runs from the unit’s
tile (never empty); valid says whether a path is legal (the game’s
rules: the unit’s move points, who stands where), and cheapest gives
the cheapest path to a tile, or None if the unit can’t reach it
(shuyi_core::Reach::path_to).
toalready on the path: the path is cut back to it.tonext to the path’s end and the longer path is legal:tois appended, so the player can steer a route.- Otherwise the cheapest path to
to, or the path unchanged iftocan’t be reached.