Skip to main content

TownView

Struct TownView 

Source
pub struct TownView<'a> {
    pub size: usize,
    pub types: &'a [CellType],
    pub regions: &'a [u16],
    pub occupants: &'a [Option<usize>],
    pub objects: &'a [Option<usize>],
    pub floors: &'a Floors,
    pub entities: &'a [EntityView],
    pub happiness: &'a [usize],
}
Expand description

The map and entities activities read.

Fields§

§size: usize

The map’s size in cells.

§types: &'a [CellType]

The type of each cell.

§regions: &'a [u16]

The walkable region of each cell.

§occupants: &'a [Option<usize>]

The occupant of each cell.

§objects: &'a [Option<usize>]

The object on each cell.

§floors: &'a Floors

The bridges’ floors (and the floor scene), for the ground under a point.

§entities: &'a [EntityView]

A view of each entity.

§happiness: &'a [usize]

The town manager’s HappinessComponent registry (Game).

Implementations§

Source§

impl TownView<'_>

Source

pub fn cell_of(&self, p: [f32; 3]) -> i32

The map cell that holds a position.

Source

pub fn reachable(&self, mask: u32, a: i32, b: i32) -> bool

Can a walker with mask get from a to b (water types skip the region test)?

Original: FUN_1400a55c0.

Source

pub fn entrance(&self, entity: usize, rng: &mut Random) -> i32

The cell a citizen walks to at an entity: its first use point (the original draws Rand(count) when there are several, but always takes point 0), else the centre of its map rectangle.

Original: FUN_14008d480(entity, 0).

Source

pub fn point_cell(&self, entity: usize) -> i32

Interact::PointPosition(entity, 0) as a cell (no draw): the first use point, else the map rectangle’s centre.

Source

pub fn can_reach(&self, cell: i32, entity: usize, rng: &mut Random) -> bool

Is entity reachable from cell?

Original: FUN_14011ada0.

Auto Trait Implementations§

§

impl<'a> Freeze for TownView<'a>

§

impl<'a> RefUnwindSafe for TownView<'a>

§

impl<'a> Send for TownView<'a>

§

impl<'a> Sync for TownView<'a>

§

impl<'a> Unpin for TownView<'a>

§

impl<'a> UnsafeUnpin for TownView<'a>

§

impl<'a> UnwindSafe for TownView<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.