pub struct RegionMap { /* private fields */ }Expand description
Region of each cell of the campaign map.
Implementations§
Source§impl RegionMap
impl RegionMap
Sourcepub fn from_map_data(map_data: &ESF) -> Result<Self>
pub fn from_map_data(map_data: &ESF) -> Result<Self>
Sourcepub fn world_size(&self) -> (f32, f32)
pub fn world_size(&self) -> (f32, f32)
Returns the size of the map in world units.
Sourcepub fn region_at(&self, cell: HexCell) -> Option<&str>
pub fn region_at(&self, cell: HexCell) -> Option<&str>
Returns the key of the region a cell belongs to.
§Returns
None for cells outside the map or with an unknown region index.
Sourcepub fn region_index_at(&self, cell: HexCell) -> Option<usize>
pub fn region_index_at(&self, cell: HexCell) -> Option<usize>
Returns the index (in REGIONS_BLOCK order) of the region a cell belongs to, or None for cells outside the map.
Sourcepub fn area_at(&self, cell: HexCell) -> Option<usize>
pub fn area_at(&self, cell: HexCell) -> Option<usize>
Returns the index of the area (in the region’s REGION_AREAS order) a cell is in, or None for cells outside
the map.
Sourcepub fn edge_masks(&self, cell: HexCell) -> [u8; 2]
pub fn edge_masks(&self, cell: HexCell) -> [u8; 2]
Returns the two hex-edge masks of a cell (bit n stands for the n-th neighbour in the game’s direction
order), or zeros for cells outside the map.
Sourcepub fn cells_by_region(&self) -> HashMap<&str, Vec<HexCell>>
pub fn cells_by_region(&self) -> HashMap<&str, Vec<HexCell>>
Returns the cells of every region, by region key.
Sourcepub fn neighbour_pairs(&self) -> HashSet<(&str, &str)>
pub fn neighbour_pairs(&self) -> HashSet<(&str, &str)>
Returns every pair of different regions with neighbouring cells, each pair once with the keys in order.
Trait Implementations§
impl StructuralPartialEq for RegionMap
Auto Trait Implementations§
impl Freeze for RegionMap
impl RefUnwindSafe for RegionMap
impl Send for RegionMap
impl Sync for RegionMap
impl Unpin for RegionMap
impl UnsafeUnpin for RegionMap
impl UnwindSafe for RegionMap
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeSend for T
impl<T> MaybeSync for T
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().impl<T> Scalar for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.