mirror of https://codeberg.org/topola/topola.git
refactor(autorouter/invoker): Add default impls. to invoker's stepper traits
This commit is contained in:
parent
53f937f14f
commit
f9b1cc2cbf
|
|
@ -189,14 +189,4 @@ impl GetObstacles for AutorouteExecutionStepper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetNavmeshDebugTexts for AutorouteExecutionStepper {
|
impl GetNavmeshDebugTexts for AutorouteExecutionStepper {}
|
||||||
fn navvertex_debug_text(&self, _navvertex: NavvertexIndex) -> Option<&str> {
|
|
||||||
// Add debug text here.
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn navedge_debug_text(&self, _navedge: (NavvertexIndex, NavvertexIndex)) -> Option<&str> {
|
|
||||||
// Add debug text here.
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -130,12 +130,4 @@ impl GetObstacles for CompareDetoursExecutionStepper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetNavmeshDebugTexts for CompareDetoursExecutionStepper {
|
impl GetNavmeshDebugTexts for CompareDetoursExecutionStepper {}
|
||||||
fn navvertex_debug_text(&self, _navvertex: NavvertexIndex) -> Option<&str> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn navedge_debug_text(&self, _navedge: (NavvertexIndex, NavvertexIndex)) -> Option<&str> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -38,13 +38,17 @@ use super::{
|
||||||
/// most importantly the navmesh which is owned by the A* stepper.
|
/// most importantly the navmesh which is owned by the A* stepper.
|
||||||
#[enum_dispatch]
|
#[enum_dispatch]
|
||||||
pub trait GetMaybeAstarStepper {
|
pub trait GetMaybeAstarStepper {
|
||||||
fn maybe_astar(&self) -> Option<&AstarStepper<Navmesh, f64>>;
|
fn maybe_astar(&self) -> Option<&AstarStepper<Navmesh, f64>> {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Trait for getting the navcord to display it on the debug overlay.
|
/// Trait for getting the navcord to display it on the debug overlay.
|
||||||
#[enum_dispatch]
|
#[enum_dispatch]
|
||||||
pub trait GetMaybeNavcord {
|
pub trait GetMaybeNavcord {
|
||||||
fn maybe_navcord(&self) -> Option<&Navcord>;
|
fn maybe_navcord(&self) -> Option<&Navcord> {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Trait for getting ghosts to display on the debug overlay. Ghosts are the
|
/// Trait for getting ghosts to display on the debug overlay. Ghosts are the
|
||||||
|
|
@ -52,7 +56,9 @@ pub trait GetMaybeNavcord {
|
||||||
/// other shapes.
|
/// other shapes.
|
||||||
#[enum_dispatch]
|
#[enum_dispatch]
|
||||||
pub trait GetGhosts {
|
pub trait GetGhosts {
|
||||||
fn ghosts(&self) -> &[PrimitiveShape];
|
fn ghosts(&self) -> &[PrimitiveShape] {
|
||||||
|
&[]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Trait for getting the obstacles that prevented Topola from creating
|
/// Trait for getting the obstacles that prevented Topola from creating
|
||||||
|
|
@ -61,15 +67,22 @@ pub trait GetGhosts {
|
||||||
/// debug overlay.
|
/// debug overlay.
|
||||||
#[enum_dispatch]
|
#[enum_dispatch]
|
||||||
pub trait GetObstacles {
|
pub trait GetObstacles {
|
||||||
fn obstacles(&self) -> &[PrimitiveIndex];
|
fn obstacles(&self) -> &[PrimitiveIndex] {
|
||||||
|
&[]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[enum_dispatch]
|
#[enum_dispatch]
|
||||||
/// Trait for getting text strings with debug information attached to navmesh
|
/// Trait for getting text strings with debug information attached to navmesh
|
||||||
/// edges and vertices.
|
/// edges and vertices.
|
||||||
pub trait GetNavmeshDebugTexts {
|
pub trait GetNavmeshDebugTexts {
|
||||||
fn navvertex_debug_text(&self, navvertex: NavvertexIndex) -> Option<&str>;
|
fn navvertex_debug_text(&self, navvertex: NavvertexIndex) -> Option<&str> {
|
||||||
fn navedge_debug_text(&self, navedge: (NavvertexIndex, NavvertexIndex)) -> Option<&str>;
|
None
|
||||||
|
}
|
||||||
|
|
||||||
|
fn navedge_debug_text(&self, navedge: (NavvertexIndex, NavvertexIndex)) -> Option<&str> {
|
||||||
|
None
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Error types that can occur during the invocation of commands.
|
/// Error types that can occur during the invocation of commands.
|
||||||
|
|
|
||||||
|
|
@ -61,36 +61,8 @@ impl MeasureLengthExecutionStepper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetMaybeAstarStepper for MeasureLengthExecutionStepper {
|
impl GetMaybeAstarStepper for MeasureLengthExecutionStepper {}
|
||||||
fn maybe_astar(&self) -> Option<&AstarStepper<Navmesh, f64>> {
|
impl GetMaybeNavcord for MeasureLengthExecutionStepper {}
|
||||||
None
|
impl GetGhosts for MeasureLengthExecutionStepper {}
|
||||||
}
|
impl GetObstacles for MeasureLengthExecutionStepper {}
|
||||||
}
|
impl GetNavmeshDebugTexts for MeasureLengthExecutionStepper {}
|
||||||
|
|
||||||
impl GetMaybeNavcord for MeasureLengthExecutionStepper {
|
|
||||||
fn maybe_navcord(&self) -> Option<&Navcord> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl GetGhosts for MeasureLengthExecutionStepper {
|
|
||||||
fn ghosts(&self) -> &[PrimitiveShape] {
|
|
||||||
&[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl GetObstacles for MeasureLengthExecutionStepper {
|
|
||||||
fn obstacles(&self) -> &[PrimitiveIndex] {
|
|
||||||
&[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl GetNavmeshDebugTexts for MeasureLengthExecutionStepper {
|
|
||||||
fn navvertex_debug_text(&self, _navvertex: NavvertexIndex) -> Option<&str> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn navedge_debug_text(&self, _navedge: (NavvertexIndex, NavvertexIndex)) -> Option<&str> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -58,36 +58,8 @@ impl PlaceViaExecutionStepper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetMaybeAstarStepper for PlaceViaExecutionStepper {
|
impl GetMaybeAstarStepper for PlaceViaExecutionStepper {}
|
||||||
fn maybe_astar(&self) -> Option<&AstarStepper<Navmesh, f64>> {
|
impl GetMaybeNavcord for PlaceViaExecutionStepper {}
|
||||||
None
|
impl GetGhosts for PlaceViaExecutionStepper {}
|
||||||
}
|
impl GetObstacles for PlaceViaExecutionStepper {}
|
||||||
}
|
impl GetNavmeshDebugTexts for PlaceViaExecutionStepper {}
|
||||||
|
|
||||||
impl GetMaybeNavcord for PlaceViaExecutionStepper {
|
|
||||||
fn maybe_navcord(&self) -> Option<&Navcord> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl GetGhosts for PlaceViaExecutionStepper {
|
|
||||||
fn ghosts(&self) -> &[PrimitiveShape] {
|
|
||||||
&[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl GetObstacles for PlaceViaExecutionStepper {
|
|
||||||
fn obstacles(&self) -> &[PrimitiveIndex] {
|
|
||||||
&[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl GetNavmeshDebugTexts for PlaceViaExecutionStepper {
|
|
||||||
fn navvertex_debug_text(&self, _navvertex: NavvertexIndex) -> Option<&str> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn navedge_debug_text(&self, _navedge: (NavvertexIndex, NavvertexIndex)) -> Option<&str> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -57,36 +57,8 @@ impl RemoveBandsExecutionStepper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl GetMaybeAstarStepper for RemoveBandsExecutionStepper {
|
impl GetMaybeAstarStepper for RemoveBandsExecutionStepper {}
|
||||||
fn maybe_astar(&self) -> Option<&AstarStepper<Navmesh, f64>> {
|
impl GetMaybeNavcord for RemoveBandsExecutionStepper {}
|
||||||
None
|
impl GetGhosts for RemoveBandsExecutionStepper {}
|
||||||
}
|
impl GetObstacles for RemoveBandsExecutionStepper {}
|
||||||
}
|
impl GetNavmeshDebugTexts for RemoveBandsExecutionStepper {}
|
||||||
|
|
||||||
impl GetMaybeNavcord for RemoveBandsExecutionStepper {
|
|
||||||
fn maybe_navcord(&self) -> Option<&Navcord> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl GetGhosts for RemoveBandsExecutionStepper {
|
|
||||||
fn ghosts(&self) -> &[PrimitiveShape] {
|
|
||||||
&[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl GetObstacles for RemoveBandsExecutionStepper {
|
|
||||||
fn obstacles(&self) -> &[PrimitiveIndex] {
|
|
||||||
&[]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl GetNavmeshDebugTexts for RemoveBandsExecutionStepper {
|
|
||||||
fn navvertex_debug_text(&self, _navvertex: NavvertexIndex) -> Option<&str> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn navedge_debug_text(&self, _navedge: (NavvertexIndex, NavvertexIndex)) -> Option<&str> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue