Skip to main content

People

Struct People 

Source
pub struct People<'a, 'b> {
Show 29 fields pub citizens: &'a mut Vec<Citizen>, pub states: &'a mut Vec<CitizenState>, pub registry: &'a mut Vec<usize>, pub homes: &'a mut BTreeMap<usize, Home>, pub rules: &'a LifeRules, pub town: &'a TownView<'b>, pub layers: &'a [[u8; 12]], pub rng: &'a mut Random, pub temperature: f32, pub diseases: &'a [Disease], pub town_disease: f32, pub storages: &'a mut [Storage], pub materials: &'a [RawMaterial], pub idle: &'a [bool], pub events: &'a mut Vec<LifeEvent>, pub dying: &'a mut Vec<(usize, i32)>, pub newborn: &'a mut dyn FnMut(&mut Random, &Citizen, bool) -> Citizen, pub born: &'a mut Vec<usize>, pub attendance: &'a mut BTreeMap<usize, Attendance>, pub attendance_list: &'a [usize], pub workforce: &'a mut Workforce, pub professions: &'a Professions, pub sites: &'a BTreeMap<usize, Site>, pub cemeteries: &'a [usize], pub tombstones: &'a BTreeMap<usize, i64>, pub burials: &'a mut Vec<(usize, i32)>, pub sectors: &'a mut SectorGraph, pub terrain: &'a HeightGrid<'b>, pub tree: &'a CharacterTree,
}
Expand description

Everything one citizen’s update touches.

Fields§

§citizens: &'a mut Vec<Citizen>

The citizens.

§states: &'a mut Vec<CitizenState>

The citizens’ states.

§registry: &'a mut Vec<usize>

The living citizens, in activation order.

§homes: &'a mut BTreeMap<usize, Home>

The homes, by entity.

§rules: &'a LifeRules

The citizen description’s rules.

§town: &'a TownView<'b>

A view of the town.

§layers: &'a [[u8; 12]]§rng: &'a mut Random

The game’s random numbers.

§temperature: f32

The environment’s temperature.

§diseases: &'a [Disease]

The diseases.

§town_disease: f32

The extra disease risk that visitors bring (0 until they are ported).

§storages: &'a mut [Storage]

The town’s storages.

§materials: &'a [RawMaterial]

The raw materials.

§idle: &'a [bool]

The character’s action stack is empty (stack_top + 1 < 1).

§events: &'a mut Vec<LifeEvent>

The log events asked for.

§dying: &'a mut Vec<(usize, i32)>

Citizens whose entity was queued for deletion, with the reason.

Original: FUN_1400c8370.

§newborn: &'a mut dyn FnMut(&mut Random, &Citizen, bool) -> Citizen

Makes a child of mother: name, sex, appearance and lifespan, with their random draws. The caller of this closure adds it to citizens.

Original: FUN_14011c550, called from FUN_140117060.

§born: &'a mut Vec<usize>

Children born this update (new citizen indices).

§attendance: &'a mut BTreeMap<usize, Attendance>

The AttendanceComponents, by entity.

§attendance_list: &'a [usize]

The service buildings that people attend.

§workforce: &'a mut Workforce

The workplaces and residences.

§professions: &'a Professions

The professions.

§sites: &'a BTreeMap<usize, Site>

The sites (their works’ priorities, a cemetery’s graves).

§cemeteries: &'a [usize]

The town’s cemeteries.

§tombstones: &'a BTreeMap<usize, i64>

The tombstones standing, with the time each one stays.

§burials: &'a mut Vec<(usize, i32)>

Burials decided this update (cemetery, grave cell); the tombstones follow.

§sectors: &'a mut SectorGraph

The path-rank cache.

§terrain: &'a HeightGrid<'b>

The ground’s heights.

§tree: &'a CharacterTree

The characters’ tree (Game): a disease spreads to the citizens about the sick.

Implementations§

Source§

impl People<'_, '_>

Source

pub fn reaches(&mut self, c: usize, entity: usize) -> bool

The home’s entrance is reachable from the citizen’s cell.

Original: FUN_14011ada0.

Source

pub fn set_home(&mut self, c: usize, home: Option<usize>, slot: i32)

Move citizen c (and its dependents) to home family slot.

Original: FUN_14011b8a0.

Source

pub fn set_guardian(&mut self, c: usize, guardian: Option<usize>)

Make guardian the guardian of c.

Original: FUN_140117470.

Source

pub fn join_service( &mut self, c: usize, service: usize, exclude: Option<usize>, ) -> bool

Join the nearest school, chapel or doctor; the school also sets.

Original: FUN_140116d10, FUN_140116bc0, FUN_140116a60.

Source

pub fn leave_service(&mut self, c: usize, service: usize, again: bool)

Leave; the school can be swapped for another at once (again).

Original: FUN_14011af20, FUN_140116b20, FUN_14011ae80.

Source

pub fn lesson(&mut self, c: usize)

Citizen message 4: a lesson; at D[0x118] lessons, or after D[0x11c] hours at school, educated (flag 0x400), out of school and an adult (9).

Original: FUN_140116c70.

Source

pub fn treated(&mut self, c: usize)

Citizen message 5: the doctor shortens the illness by D[0x12c] minutes.

Original: FUN_140116a10.

Source

pub fn die( &mut self, c: usize, reason: i32, extra: Option<(Option<String>, String)>, ) -> bool

Queue the citizen’s death (reason) and tell the family. When the citizen is buried in a cemetery (found from the home’s entrance, else from where the citizen stands), the family’s bit is 0x40; otherwise it is 2 for old age, else 0x80. Not ported: the debug flag that stops deaths (Game bit 8).

Original: FUN_14011c2a0; the cemetery search is FUN_14008ec10.

Source

pub fn bury(&mut self, c: usize)

The family part of a citizen’s removal: the citizen leaves school, the doctor, the chapel, the home and the guardian. A widow or widower takes the dependents; otherwise children die (orphaned) and older dependents leave. The partner is single again.

Original: FUN_140119170 (the removal of a CitizenComponent).

Source

pub fn update(&mut self, c: usize, dt: i64)

One scheduled update of citizen c over dt.

Original: FUN_140118340.

Auto Trait Implementations§

§

impl<'a, 'b> !RefUnwindSafe for People<'a, 'b>

§

impl<'a, 'b> !Send for People<'a, 'b>

§

impl<'a, 'b> !Sync for People<'a, 'b>

§

impl<'a, 'b> !UnwindSafe for People<'a, 'b>

§

impl<'a, 'b> Freeze for People<'a, 'b>

§

impl<'a, 'b> Unpin for People<'a, 'b>

§

impl<'a, 'b> UnsafeUnpin for People<'a, 'b>

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.