pub struct GameMap {
height: u32,
width: u32,
province_map: RgbImage,
title_color_map: HashMap<Rc<str>, Rgb<u8>>,
}
Expand description
A struct representing a game map, from which we can create [Map] instances
Fields§
§height: u32
§width: u32
§province_map: RgbImage
§title_color_map: HashMap<Rc<str>, Rgb<u8>>
Implementations§
Source§impl GameMap
impl GameMap
Sourcepub fn new<P: AsRef<Path>>(
provinces_path: P,
rivers_path: P,
definition_path: P,
province_barony_map: &HashMap<u32, Rc<str>>,
) -> Result<Self, MapError>
pub fn new<P: AsRef<Path>>( provinces_path: P, rivers_path: P, definition_path: P, province_barony_map: &HashMap<u32, Rc<str>>, ) -> Result<Self, MapError>
Creates a new GameMap from a province map and a definition.csv file located inside the provided path. The function expects the path to be a valid CK3 game directory.
Trait Implementations§
Source§impl MapGenerator for GameMap
impl MapGenerator for GameMap
Source§fn create_map<C: Into<Rgb<u8>> + Clone, F: Fn(&str) -> C, I: IntoIterator<Item = Rc<str>>>(
&self,
assoc: F,
key_list: Option<I>,
) -> RgbImage
fn create_map<C: Into<Rgb<u8>> + Clone, F: Fn(&str) -> C, I: IntoIterator<Item = Rc<str>>>( &self, assoc: F, key_list: Option<I>, ) -> RgbImage
Creates a new instance of map, with pixels colored in accordance with assoc function. key_list acts as a whitelist of keys to use assoc on. If it’s None then assoc is applied to all keys.
Source§fn create_map_flat<C: Into<Rgb<u8>> + Clone, I: IntoIterator<Item = Rc<str>>>(
&self,
key_list: I,
target_color: C,
) -> RgbImage
fn create_map_flat<C: Into<Rgb<u8>> + Clone, I: IntoIterator<Item = Rc<str>>>( &self, key_list: I, target_color: C, ) -> RgbImage
Creates a new instance of map, with all pixels corresponding to keys in the key_list colored same as the target_color
Auto Trait Implementations§
impl Freeze for GameMap
impl RefUnwindSafe for GameMap
impl !Send for GameMap
impl !Sync for GameMap
impl Unpin for GameMap
impl UnwindSafe for GameMap
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
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 more