Skip to main content

Cells

Struct Cells 

Source
pub struct Cells {
Show 15 fields pub size: usize, pub types: Vec<CellType>, pub types_revision: u64, pub objects: Vec<Option<usize>>, pub occupants: Vec<Option<usize>>, pub flags: Vec<u8>, pub previous_template: Vec<Option<usize>>, pub growth_bytes: Vec<u8>, pub layers: Vec<[u8; 12]>, pub layer_totals: [i16; 12], pub road_kind: Vec<u8>, pub road_built: Vec<u8>, pub road_revision: u32, pub floors: Floors, pub sector_marks: Vec<u32>,
}
Expand description

The gameplay map cells seeding reads and writes (Game, 48-byte cells).

Fields§

§size: usize

The map’s size in cells.

§types: Vec<CellType>

The type of each cell. Change it only with Cells::set_type, which keeps Cells::types_revision current.

§types_revision: u64

A new stamp whenever types may have changed (a new map, any set_type), so readers such as the path regions can skip comparing the whole map when it has not.

§objects: Vec<Option<usize>>

Entity on the cell (index into the placed list).

§occupants: Vec<Option<usize>>

The entity occupying each cell, for placement checks (separate from the objects stamped into the cell).

§flags: Vec<u8>

Placement admission flag, deliberately unnamed.

§previous_template: Vec<Option<usize>>

External ComponentDescription reference from a growth transition.

§growth_bytes: Vec<u8>

A byte per cell that growth adjusts.

§layers: Vec<[u8; 12]>

Per-cell layer counters: 0..=5 the HappinessComponent kinds, 8 the fishing docks.

Original: FUN_1400a4e60.

§layer_totals: [i16; 12]

Map: registrations per layer.

§road_kind: Vec<u8>

The road kind the cell has or will have (0 stone, 1 dirt; 0xff none).

§road_built: Vec<u8>

The road kind built (0x80 while it is being built).

§road_revision: u32

Bumped whenever a road is planned, taken back or finished (the road decals’ rebuild).

Original: FUN_1400b4840.

§floors: Floors

The floors (bridge decks) that characters walk on.

§sector_marks: Vec<u32>

Cells that turned walkable or unwalkable, in the order they did: the path sectors’ marks, which every type write in the original makes on the spot.

Original: FUN_1400ae160.

Implementations§

Source§

impl Cells

Source

pub fn entity_at(&self, i: usize) -> Option<usize>

The entity a cell answers for, the occupant if there is one, else the object. EditTool selection, the removal tool and the job code all read cells this way.

Original: FUN_1400a5750.

Source

pub fn new(size: usize, types: Vec<CellType>) -> Cells

The cells of a map of size × size cells with these natural types.

Source

pub fn set_type(&mut self, i: usize, ty: CellType)

Write a cell’s type. When the cell turns walkable or unwalkable, its path sector is marked for rebuilding.

Source

pub fn add_layer( &mut self, layer: usize, cx: i32, cy: i32, radius: i32, delta: i32, )

Add delta to layer on every cell within radius of (cx, cy) (a byte, wrapping) and to the layer’s total.

Original: FUN_1400a4e60.

Auto Trait Implementations§

§

impl Freeze for Cells

§

impl RefUnwindSafe for Cells

§

impl Send for Cells

§

impl Sync for Cells

§

impl Unpin for Cells

§

impl UnsafeUnpin for Cells

§

impl UnwindSafe for Cells

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.