pub struct MapRegion { /* private fields */ }Expand description
A region of the map (REGION_DATA), land or sea.
Implementations§
Source§impl MapRegion
impl MapRegion
Sourcepub fn area_groups(&self) -> &Vec<u32>
pub fn area_groups(&self) -> &Vec<u32>
Connectivity group of each of the region’s areas (REGION_AREA_DATA), in map order.
Sourcepub fn area_sizes(&self) -> &Vec<u32>
pub fn area_sizes(&self) -> &Vec<u32>
Size of each of the region’s areas, in map order.
Sourcepub fn connections(&self) -> &Vec<(usize, u32)>
pub fn connections(&self) -> &Vec<(usize, u32)>
Directly traversable connections to other regions (same kind of region first, then the other kind), as (region index, value) pairs.
Source§impl MapRegion
impl MapRegion
Sourcepub fn connects_to_other_kind(&self) -> bool
pub fn connects_to_other_kind(&self) -> bool
The region connects directly to a region of the other kind (land to sea or sea to land).
Sourcepub fn has_settlement(&self) -> bool
pub fn has_settlement(&self) -> bool
The region has a settlement (land regions do, seas don’t).
Source§impl MapRegion
impl MapRegion
Sourcepub fn all_from_map_data(map_data: &ESF) -> Result<Vec<Self>>
pub fn all_from_map_data(map_data: &ESF) -> Result<Vec<Self>>
Reads every region of a map_data.esf, in map order.
§Errors
Returns an error if the map lacks its regions block or a region is malformed.
Sourcepub fn hlcis(&self) -> Vec<(u32, Vec<u32>)>
pub fn hlcis(&self) -> Vec<(u32, Vec<u32>)>
Returns the region’s HLCIs: the distinct connectivity groups of its areas, in the order they first appear, each with the indexes of its areas.
Sourcepub fn largest_area(&self) -> Option<usize>
pub fn largest_area(&self) -> Option<usize>
Returns the index of the region’s largest area (the first one on ties), if it has areas.
Sourcepub fn hlci_of_area(&self, area: usize) -> Option<usize>
pub fn hlci_of_area(&self, area: usize) -> Option<usize>
Returns the index of the HLCI holding an area.
Trait Implementations§
impl StructuralPartialEq for MapRegion
Auto Trait Implementations§
impl Freeze for MapRegion
impl RefUnwindSafe for MapRegion
impl Send for MapRegion
impl Sync for MapRegion
impl Unpin for MapRegion
impl UnsafeUnpin for MapRegion
impl UnwindSafe for MapRegion
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
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> ⓘ
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> ⓘ
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,
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>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
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
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.