Struct movingai::MovingAiMap
source · pub struct MovingAiMap { /* private fields */ }
Expand description
Contains data structure for 2D MovingAI maps. An immutable representation of a MovingAI map.
Implementations§
source§impl MovingAiMap
impl MovingAiMap
sourcepub fn new(
map_type: String,
height: usize,
width: usize,
map: Vec<char>
) -> MovingAiMap
pub fn new( map_type: String, height: usize, width: usize, map: Vec<char> ) -> MovingAiMap
Create a new MovingAIMap
object from basic components.
§Arguments
map_type
: The type of map you are registering. Usuallyoctile
.height
: the height of the map.width
: the width of the map.map
: A vector representing the map in row-major order.
§Panics
The new
call will panic id the size of the map vector is different
from heigth*width
.
sourcepub fn new_from_slice(
map_type: String,
height: usize,
width: usize,
map: Box<[char]>
) -> MovingAiMap
pub fn new_from_slice( map_type: String, height: usize, width: usize, map: Box<[char]> ) -> MovingAiMap
Create a new MovingAIMap
object from basic components.
§Arguments
map_type
: The type of map you are registering. Usuallyoctile
.height
: the height of the map.width
: the width of the map.map
: A boxed slice representing the map in row-major order.
§Panics
The new
call will panic id the size of the map vector is different
from heigth*width
.
Trait Implementations§
source§impl Debug for MovingAiMap
impl Debug for MovingAiMap
source§impl Map2D<char> for MovingAiMap
impl Map2D<char> for MovingAiMap
source§fn get(&self, coords: Coords2D) -> &char
fn get(&self, coords: Coords2D) -> &char
In every Map2D must be possible to get a tile. Read more
source§fn is_out_of_bound(&self, coords: Coords2D) -> bool
fn is_out_of_bound(&self, coords: Coords2D) -> bool
Check if the given coordinates are out of bound. Read more
source§fn is_traversable(&self, tile: Coords2D) -> bool
fn is_traversable(&self, tile: Coords2D) -> bool
Check if a tile in the map can be traversed. Read more
source§fn is_traversable_from(&self, from: Coords2D, to: Coords2D) -> bool
fn is_traversable_from(&self, from: Coords2D, to: Coords2D) -> bool
Check if a tile in the map can be traversed coming from the
from
tile. Read moresource§fn coords(&self) -> CoordsIter ⓘ
fn coords(&self) -> CoordsIter ⓘ
Return an iterator returning all the coordinates in the map
in row-major order.
source§fn free_states(&self) -> usize
fn free_states(&self) -> usize
Return the number of free states of a map. Read more
Auto Trait Implementations§
impl Freeze for MovingAiMap
impl RefUnwindSafe for MovingAiMap
impl Send for MovingAiMap
impl Sync for MovingAiMap
impl Unpin for MovingAiMap
impl UnwindSafe for MovingAiMap
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more