use crate::entity::EntityId;
use crate::world::World;
use super::{DispatchManifest, DispatchStrategy, ElevatorGroup};
pub struct NearestCarDispatch;
impl NearestCarDispatch {
#[must_use]
pub const fn new() -> Self {
Self
}
}
impl Default for NearestCarDispatch {
fn default() -> Self {
Self::new()
}
}
impl DispatchStrategy for NearestCarDispatch {
fn rank(
&mut self,
_car: EntityId,
car_position: f64,
_stop: EntityId,
stop_position: f64,
_group: &ElevatorGroup,
_manifest: &DispatchManifest,
_world: &World,
) -> Option<f64> {
Some((car_position - stop_position).abs())
}
}