mirror of https://codeberg.org/topola/topola.git
refactor(navcord): inline 'binavvertex', 'maybe_cw' helpers
This commit is contained in:
parent
ba8aa2fe5a
commit
5dab7d9100
|
|
@ -61,9 +61,12 @@ impl NavcordStepper {
|
||||||
head: Head,
|
head: Head,
|
||||||
around: NavvertexIndex,
|
around: NavvertexIndex,
|
||||||
) -> Result<CaneHead, NavcorderException> {
|
) -> Result<CaneHead, NavcorderException> {
|
||||||
let cw = Self::maybe_cw(navmesh, around).ok_or(NavcorderException::CannotWrap)?;
|
let around_node_weight = navmesh.node_weight(around).unwrap();
|
||||||
|
let cw = around_node_weight
|
||||||
|
.maybe_cw
|
||||||
|
.ok_or(NavcorderException::CannotWrap)?;
|
||||||
|
|
||||||
match Self::binavvertex(navmesh, around) {
|
match around_node_weight.node {
|
||||||
BinavvertexNodeIndex::FixedDot(dot) => {
|
BinavvertexNodeIndex::FixedDot(dot) => {
|
||||||
self.wrap_around_fixed_dot(layout, head, dot, cw)
|
self.wrap_around_fixed_dot(layout, head, dot, cw)
|
||||||
}
|
}
|
||||||
|
|
@ -93,14 +96,6 @@ impl NavcordStepper {
|
||||||
) -> Result<CaneHead, NavcorderException> {
|
) -> Result<CaneHead, NavcorderException> {
|
||||||
Ok(layout.cane_around_bend(&mut self.recorder, head, around.into(), cw, self.width)?)
|
Ok(layout.cane_around_bend(&mut self.recorder, head, around.into(), cw, self.width)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn binavvertex(navmesh: &Navmesh, navvertex: NavvertexIndex) -> BinavvertexNodeIndex {
|
|
||||||
navmesh.node_weight(navvertex).unwrap().node
|
|
||||||
}
|
|
||||||
|
|
||||||
fn maybe_cw(navmesh: &Navmesh, navvertex: NavvertexIndex) -> Option<bool> {
|
|
||||||
navmesh.node_weight(navvertex).unwrap().maybe_cw
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct NavcordStepContext<'a, R> {
|
pub struct NavcordStepContext<'a, R> {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue