pub struct Map {
pub size: usize,
pub types: Vec<CellType>,
}Expand description
The gameplay map: the type of each cell. See Map::find_start for the start of a new town.
Fields§
§size: usizeCells per side (n).
types: Vec<CellType>Cell type (byte) per cell, row-major.
Implementations§
Source§impl Map
impl Map
Sourcepub fn new(size: usize, terrain: &HeightGrid<'_>) -> Map
pub fn new(size: usize, terrain: &HeightGrid<'_>) -> Map
Classify every cell from the terrain.
Original: FUN_1400a43f0.
Sourcepub fn is_clear(&self, x: i32, y: i32, radius: i32, radius_sq: i32) -> bool
pub fn is_clear(&self, x: i32, y: i32, radius: i32, radius_sq: i32) -> bool
Every cell within radius (dx² + dy² ≤ radius_sq) of (x, y) is in the map and buildable
ground.
Original: FUN_1400a7d50.
Sourcepub fn find_start(&self, radius: i32) -> (i32, i32)
pub fn find_start(&self, radius: i32) -> (i32, i32)
The town’s start cell. Rings outward from the map centre, testing 4, 8, 16, … evenly
spaced angles per ring and moving out 3r/4 cells each ring. Loops forever (as the original
does) if no clear area exists.
Original: FUN_1400a7bf0.
Auto Trait Implementations§
impl Freeze for Map
impl RefUnwindSafe for Map
impl Send for Map
impl Sync for Map
impl Unpin for Map
impl UnsafeUnpin for Map
impl UnwindSafe for Map
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