pub struct RegionGraph { /* private fields */ }Expand description
Regions, the walk distance between neighbours, and for each region the set
of regions that must be resident while the player is in it (the cooker’s
closure V(R)).
Implementations§
Source§impl RegionGraph
impl RegionGraph
Sourcepub fn chain(count: u32, sectors: u32, length: u32) -> Self
pub fn chain(count: u32, sectors: u32, length: u32) -> Self
A chain of count regions of sectors sectors, neighbours length
units apart, each needing itself only until Self::needs_with_neighbors.
Sourcepub fn grid(width: u32, height: u32, sectors: u32, length: u32) -> Self
pub fn grid(width: u32, height: u32, sectors: u32, length: u32) -> Self
A width x height grid, row-major on disc, neighbours length apart.
Sourcepub fn add_region(&mut self, sectors: u32) -> u32
pub fn add_region(&mut self, sectors: u32) -> u32
Add a region; returns its id (ids are dense from 0). Its disc position
is set by Self::layout_in_order or Self::place.
Sourcepub fn layout_in_order(&mut self, start_lba: u32, gap: u32)
pub fn layout_in_order(&mut self, start_lba: u32, gap: u32)
Lay regions out in id order from start_lba, gap sectors apart.
Sourcepub fn connect(&mut self, a: u32, b: u32, length: u32)
pub fn connect(&mut self, a: u32, b: u32, length: u32)
Connect two regions both ways, length units apart.
Sourcepub fn set_needs(&mut self, region: u32, needs: &[u32])
pub fn set_needs(&mut self, region: u32, needs: &[u32])
Set the regions that must be resident while the player is in region.
Sourcepub fn needs_with_neighbors(&mut self)
pub fn needs_with_neighbors(&mut self)
Every region needs itself and its direct neighbours.
Sourcepub fn region_count(&self) -> usize
pub fn region_count(&self) -> usize
Number of regions.
Sourcepub fn edge_length(&self, a: u32, b: u32) -> Option<u32>
pub fn edge_length(&self, a: u32, b: u32) -> Option<u32>
Edge length between two neighbours.
Sourcepub fn total_sectors(&self) -> u64
pub fn total_sectors(&self) -> u64
Total sectors of all regions.
Sourcepub fn distances_from(&self, from: u32) -> Vec<u32>
pub fn distances_from(&self, from: u32) -> Vec<u32>
Walk distance from from to every region (Dijkstra over edge
lengths); u32::MAX for unreachable regions.
Trait Implementations§
Source§impl Clone for RegionGraph
impl Clone for RegionGraph
Source§fn clone(&self) -> RegionGraph
fn clone(&self) -> RegionGraph
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RegionGraph
impl Debug for RegionGraph
Source§impl Default for RegionGraph
impl Default for RegionGraph
Source§fn default() -> RegionGraph
fn default() -> RegionGraph
Auto Trait Implementations§
impl Freeze for RegionGraph
impl RefUnwindSafe for RegionGraph
impl Send for RegionGraph
impl Sync for RegionGraph
impl Unpin for RegionGraph
impl UnsafeUnpin for RegionGraph
impl UnwindSafe for RegionGraph
Blanket Implementations§
§impl<T> Any for Twhere
T: 'static + ?Sized,
impl<T> Any for Twhere
T: 'static + ?Sized,
§impl<T> Borrow<T> for Twhere
T: ?Sized,
impl<T> Borrow<T> for Twhere
T: ?Sized,
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
clone_to_uninit)