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>,
) -> Result<MovingAiMap, ParseError>
pub fn new( map_type: String, height: usize, width: usize, map: Vec<char>, ) -> Result<MovingAiMap, ParseError>
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.
§Errors
Returns an error if the size of the map vector is different from height * width.
Sourcepub fn new_from_slice(
map_type: String,
height: usize,
width: usize,
map: Box<[char]>,
) -> Result<MovingAiMap, ParseError>
pub fn new_from_slice( map_type: String, height: usize, width: usize, map: Box<[char]>, ) -> Result<MovingAiMap, ParseError>
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.
§Errors
Returns an error if the size of the map vector is different from height * 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 UnsafeUnpin 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