Skip to main content

Pathfinder

Struct Pathfinder 

Source
pub struct Pathfinder {
    pub mask: u32,
    /* private fields */
}
Expand description

The pathfinder: the map’s cells, the cost of each cell type, and the state of the A* search.

Original: FUN_1400abcc0 (the path manager).

Fields§

§mask: u32

Allowed types (command 0).

Implementations§

Source§

impl Pathfinder

Source

pub fn new(size: usize, types: &[CellType]) -> Pathfinder

Built from the map with diagonal steps on.

Original: FUN_1400a3d90.

Source

pub fn set_type(&mut self, cell: usize, t: CellType)

Command 2: a cell’s type changed.

Source

pub fn set_blocked(&mut self, cell: usize, blocked: bool)

Command 3.

Source

pub fn set_mode(&mut self, mode: u32)

Select a mover’s cost table and diagonal option.

Original: FUN_1400a3a20.

Source

pub fn find_road( &mut self, from: i32, to: i32, mask: u32, manhattan: bool, blocked: &[bool], ) -> Option<Vec<i32>>

The cells of a road from one cell to another: every cell type costs 1, there are no diagonal steps, and blocked cells and cells outside mask are avoided. blocked marks the cells that have an occupant.

Original: FUN_1400a22d0; its search options FUN_1400abd80(0, manhattan, 1).

Source

pub fn keeping_state<T>(&mut self, search: impl FnOnce(&mut Self) -> T) -> T

Run search and put the costs, diagonal, heuristic, blocked check and mask back.

Source

pub fn find(&mut self, from: i32, to: i32) -> Option<Vec<i32>>

The cells from from to to inclusive, or None.

Original: FUN_14001d760.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.