Skip to main content

Sim

Struct Sim 

Source
pub struct Sim<'s, 't> {
Show 71 fields pub characters: &'s mut [Character], pub states: &'s mut [CitizenState], pub groups: &'s [Option<&'s AnimationGroup>], pub adult: &'s [bool], pub rules: CitizenRulesAi, pub size: usize, pub cells: &'s mut Cells, pub regions: &'s [u16], pub sectors: &'s mut SectorGraph, pub terrain: &'s HeightGrid<'t>, pub placed: &'s mut Vec<Placed>, pub templates: &'s [Template], pub entities: &'s [EntityView], pub storages: &'s mut [Storage], pub storage_sites: &'s [StorageSite], pub materials: &'s [RawMaterial], pub rng: &'s mut Random, pub stock: [(i32, i32); 21], pub temperature: f32, pub professions: &'s Professions, pub workforce: &'s mut Workforce, pub site_templates: &'s [SiteTemplate], pub sites: &'s mut BTreeMap<usize, Site>, pub homes: &'s mut BTreeMap<usize, Home>, pub attendance: &'s mut BTreeMap<usize, Attendance>, pub attendance_list: &'s mut Vec<usize>, pub healers: &'s mut Vec<usize>, pub happiness: &'s mut Vec<usize>, pub calendar: f32, pub year: u32, pub fruits: &'s mut BTreeMap<usize, Fruit>, pub wildlife: &'s mut Wildlife, pub keep_piles: &'s mut BTreeMap<usize, bool>, pub site_events: &'s mut Vec<(i32, i32, usize)>, pub storage_changes: &'s mut Vec<(usize, bool)>, pub rebuilds: &'s mut Vec<Rebuild>, pub water: &'s mut Water, pub game_flags: u32, pub precipitation: bool, pub population: i32, pub visitors: &'s mut (f32, i64), pub pending_roads: &'s mut BTreeMap<i32, i32>, pub terraform_requests: &'s mut Vec<Terraform>, pub flatten_requests: &'s mut Vec<[i32; 4]>, pub tornadoes: &'s mut BTreeMap<usize, Tornado>, pub tornado_kills: &'s mut Vec<usize>, pub trackers: &'s mut BTreeMap<usize, Tracker>, pub decals: &'s mut BTreeMap<usize, Decal>, pub counters: &'s mut StockCounters, pub trading_posts: &'s mut Vec<usize>, pub trade_value: &'s mut i32, pub known_materials: &'s mut Vec<usize>, pub known: &'s mut Vec<usize>, pub trade_goods: &'s [TradeGood], pub river: &'s [[f32; 2]], pub pathfinder: &'s mut Pathfinder, pub names: Option<&'s (NameDatabase, NameDatabase)>, pub site_dt: i64, pub cemeteries: &'s mut Vec<usize>, pub tombstones: &'s mut BTreeMap<usize, i64>, pub burials: &'s mut Vec<(usize, i32)>, pub site_list: &'s mut Vec<usize>, pub events: Vec<JobEvent>, pub piles: &'s mut BTreeMap<usize, Pile>, pub claimed: &'s mut BTreeSet<usize>, pub new_piles: &'s mut Vec<usize>, pub models_dirty: &'s mut bool, pub offers: Vec<i32>, pub removed: Vec<usize>, pub animation_events: Vec<(usize, String)>, pub offers_again: bool, /* private fields */
}
Expand description

Everything a work slot or a state callback touches.

Fields§

§characters: &'s mut [Character]

The citizens’ characters.

§states: &'s mut [CitizenState]

The citizens’ states.

§groups: &'s [Option<&'s AnimationGroup>]

Each citizen’s animation group.

§adult: &'s [bool]

Adult and not at school (the citizens assignment counts).

§rules: CitizenRulesAi

The citizens’ AI rules.

§size: usize

The map’s size in cells.

§cells: &'s mut Cells

The gameplay map.

§regions: &'s [u16]

The walkable region of each cell.

§sectors: &'s mut SectorGraph

The sector graph.

§terrain: &'s HeightGrid<'t>

The ground’s heights.

§placed: &'s mut Vec<Placed>

The placed objects.

§templates: &'s [Template]

The object templates.

§entities: &'s [EntityView]

A view of each entity.

§storages: &'s mut [Storage]

The town’s storages.

§storage_sites: &'s [StorageSite]

The storage sites.

§materials: &'s [RawMaterial]

The raw materials.

§rng: &'s mut Random

The game’s random numbers.

§stock: [(i32, i32); 21]

The stock manager’s (count, limit) per slot from the last recount.

§temperature: f32

The environment’s temperature.

§professions: &'s Professions

The professions.

§workforce: &'s mut Workforce

The workers assigned to each workplace.

§site_templates: &'s [SiteTemplate]

The building templates.

§sites: &'s mut BTreeMap<usize, Site>

The buildings, by entity.

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

The homes, by entity.

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

Who attends each service building, by entity.

§attendance_list: &'s mut Vec<usize>

The service buildings that people attend.

§healers: &'s mut Vec<usize>

The herbalists and hospitals.

§happiness: &'s mut Vec<usize>

The buildings that raise happiness nearby.

§calendar: f32

The calendar’s seconds into the year.

§year: u32

The current year.

§fruits: &'s mut BTreeMap<usize, Fruit>

The orchards’ fruit, by entity.

§wildlife: &'s mut Wildlife

The animals (livestock and their pastures).

§keep_piles: &'s mut BTreeMap<usize, bool>

Whether removing a resource leaves its piles behind, by resource.

§site_events: &'s mut Vec<(i32, i32, usize)>

Building events for the event log: (kind, argument, entity).

§storage_changes: &'s mut Vec<(usize, bool)>

Storages that opened or closed: (entity, opened).

§rebuilds: &'s mut Vec<Rebuild>

The buildings to build again after they were destroyed.

§water: &'s mut Water

The town’s water sources (wells and shore points).

§game_flags: u32

The game’s debug flags (all four disaster bits are set when disasters are off).

§precipitation: bool

The sky’s state is precipitation (environment = 0).

§population: i32

The town’s population.

§visitors: &'s mut (f32, i64)

The visitors’ timer and the time of the last visitor.

§pending_roads: &'s mut BTreeMap<i32, i32>

The planned road cells, each with its road-building work.

§terraform_requests: &'s mut Vec<Terraform>

The pending changes to the ground.

§flatten_requests: &'s mut Vec<[i32; 4]>

The rectangles to flatten: [x0, y0, x1, y1].

§tornadoes: &'s mut BTreeMap<usize, Tornado>

The tornadoes, by entity.

§tornado_kills: &'s mut Vec<usize>

The citizens a tornado killed.

§trackers: &'s mut BTreeMap<usize, Tracker>

The production trackers, by entity.

§decals: &'s mut BTreeMap<usize, Decal>

The ground decals of building sites, by entity.

§counters: &'s mut StockCounters

The counts of goods made and used.

§trading_posts: &'s mut Vec<usize>

The town’s trading posts.

§trade_value: &'s mut i32

The total value traded.

§known_materials: &'s mut Vec<usize>

The raw materials the town knows; known holds the crops, orchard trees and livestock it knows.

Original: FUN_140097330, FUN_140096ef0.

§known: &'s mut Vec<usize>

The crops, orchard trees and livestock the town knows.

§trade_goods: &'s [TradeGood]

The goods traders can bring.

§river: &'s [[f32; 2]]

The river’s path.

§pathfinder: &'s mut Pathfinder

The path manager (the trader boats’ water paths).

§names: Option<&'s (NameDatabase, NameDatabase)>

The citizens’ name databases (the merchants’ names).

§site_dt: i64

The scheduled update’s elapsed time (ticks) for the site callbacks.

§cemeteries: &'s mut Vec<usize>

The cemeteries.

§tombstones: &'s mut BTreeMap<usize, i64>

The tombstones, with the time each one stays.

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

The burials waiting: (cemetery, cell).

§site_list: &'s mut Vec<usize>

The buildings that have a site record.

§events: Vec<JobEvent>

The job events from this update.

§piles: &'s mut BTreeMap<usize, Pile>

The piles, by entity.

§claimed: &'s mut BTreeSet<usize>

The resources a work has claimed.

§new_piles: &'s mut Vec<usize>

The piles made in this update.

§models_dirty: &'s mut bool

Set when a model changed and must be drawn again.

§offers: Vec<i32>

Works a ClearArea try asked the manager to offer (WorkHost::take_offers).

§removed: Vec<usize>

Scratch for Sim::seeder (planting removes nothing and plays no sounds).

§animation_events: Vec<(usize, String)>

The animation events to play: (entity, effect).

§offers_again: bool

Whether the offers get a second try (as an auto-pickup’s do).

Original: FUN_1400fdaf0(.., 1).

Implementations§

Source§

impl Sim<'_, '_>

Source

pub fn update_commute( &mut self, job: &mut Commute, citizens: &[Citizen], dt: i64, )

StockManager::Update’s part: the clock, then a step, or a new start when idle.

Source§

impl Sim<'_, '_>

Source

pub fn update_boats(&mut self)

The boats’ StateMachine updates: 0 sailing in, gone at the route’s end (the post hears it, message 0xb), approaching within eight of the dock; 1 slowing to the dock, docked within 0.2; 3 heading back to the route, sailing out within three; 4 gone at the route’s end.

Original: FUN_140045bb0, FUN_140045950, FUN_140045670, FUN_1400455a0.

Source§

impl Sim<'_, '_>

Source

pub fn trade_message(&mut self, e: usize, msg: i32)

The post’s state messages: 9 in 0x12 the boat docked: event 13 at severity 2, → 0x13; 0xb in 0x12 it went without docking: → 2; 0xa in 0x13 the merchant leaves now.

Original: FUN_14005b1b0, FUN_14005b320, FUN_14005bba0.

Source

pub fn toggle_trade_work(&mut self, jobs: &mut Jobs, e: usize)

The TradeWork switched (the post’s work button): the workplace on with the work, or off without it.

Original: FUN_14005c960.

Source§

impl Sim<'_, '_>

Source

pub fn sell_value(&self, e: usize, material: usize) -> i32

sell_value at the post e.

Source

pub fn exchange( &mut self, e: usize, sell: &[(usize, i32)], buy: &[(usize, i32)], )

TradeUI’s trade button, while the merchant is docked: the visitors’ disease risk; what is sold leaves the post (used) and its value counts as traded away; what is bought leaves the merchant’s goods and arrives: raw materials in the post’s storage (known), seeds known, livestock known and at the post.

Original: FUN_1400868f0, FUN_14005b640.

Source

pub fn trade_setting(&mut self, e: usize, setting: TradeSetting)

TradeUI’s settings: see TradeSetting.

Original: FUN_140086f80, FUN_1400871d0, FUN_140087120, FUN_140087090, FUN_140087350, FUN_1400872a0.

Source§

impl Sim<'_, '_>

Source

pub fn update_blight(&mut self, visits: &[(usize, i64)])

DiseaseComponent’s scheduled update of every site that has one.

Original: FUN_1400494f0.

Source§

impl Sim<'_, '_>

Source

pub fn update_fires(&mut self, jobs: &mut Jobs, visits: &[(usize, i64)])

FireComponent’s scheduled update of every building that has one: not burning, the ignition odds (unless fires are off); burning, the spread and the burn running out.

Original: FUN_140049910.

Source

pub fn ignite(&mut self, jobs: &mut Jobs, e: usize)

A building neither damaged nor being torn down is damaged for half the burn; it burns, gets its FireWork (prioritised), marks the emergency around it and, as the first fire, posts event 31. The particles and the fire sound follow burn in the app (docs/PARTICLES.md, Ambience::drive_entities). (AutoSlow, settings, comes from the event: EventLog::add.)

Original: FireComponent::Ignite, FUN_140049f70.

Source

pub fn put_out(&mut self, jobs: &mut Jobs, e: usize)

It is rubble now; its work and emergency go; the particles fade and the fire sound stops with burn at 0 (in the app).

Original: FireComponent::PutOut, FUN_140049e20.

Source

pub fn fire_message(&mut self, jobs: &mut Jobs, e: usize, msg: i32)

FireComponent’s message slot: message 0, a bucket of water.

Original: FUN_1400499f0.

Source§

impl Sim<'_, '_>

Source

pub fn update_tornadoes(&mut self, jobs: &mut Jobs, dt: i64)

Every tornado’s update for dt ticks.

Original: FUN_140058630.

Source§

impl Sim<'_, '_>

Source

pub fn place_burials(&mut self)

The burials decided this update: the grave becomes plain ground and gets a tombstone turned as the cemetery, which lasts its tombstone description’s time and stamps its cell.

Original: FUN_1400473f0; the tombstone’s set-up FUN_1400581c0.

Source§

impl Sim<'_, '_>

Source

pub fn happiness_visit(&mut self, e: usize)

Message 0, a citizen’s visit: one unit of the first stored raw material that matches and is not reserved is used up, and counted.

Original: FUN_14004b0e0.

Source§

impl Sim<'_, '_>

Source

pub fn update_nomads(&mut self, dt: i64)

The nomads’ StateMachine updates: 0 at the town hall, it tells it (message 6) and waits; 1 waiting, it wanders now and then; 2 back where it came from, it is gone.

Original: FUN_140050320, FUN_14004ff60, FUN_14004fe90.

Source

pub fn immigration_message(&mut self, e: usize, msg: i32)

The ImmigrationComponent’s state messages: 6 a nomad arrived (in 0x10); 8 turned away (in 0x11). Message 7 (taking them in) needs the citizens: crate::behaviour::agents::Agents::admit_band.

Original: FUN_14004d950, FUN_14004d680, FUN_14004d6f0.

Source

pub fn take_band(&mut self, e: usize) -> Option<Vec<(usize, [f32; 3])>>

The visitors’ disease risk (the larger of the town’s and, for the longer of the town’s and months) and the band (each nomad and where it stands) for the citizens to be made. None unless the band is waiting (0x11).

Original: FUN_14004ddb0 (town side).

Source

pub fn band_taken(&mut self, e: usize)

After the citizens are made: each nomad is gone (message 0) and the town hall goes back to 2.

Source§

impl Sim<'_, '_>

Source

pub fn update_attendance(&mut self, visits: &[(usize, i64)])

The scheduled update of a school, chapel or doctor: when nobody works there, everyone leaves.

Original: FUN_140044cd0.

Source§

impl Sim<'_, '_>

Source

pub fn crop_plant_now(&mut self, e: usize)

Plant now (also the field’s message 3 in state 2).

Original: FUN_14011fc80.

Source

pub fn set_crop(&mut self, e: usize, crop: Option<usize>)

CropUI slot.

Original: FUN_1400b7df0.

Source

pub fn field_action(&mut self, e: usize, action: i32)

CropFieldComponent slot: 0 sends the machine message 3 (handled in state 2: plant now), 1 message 4 (state 10: harvest now), 2 switches farming on or off.

Original: FUN_140120190.

Source

pub fn crop_harvest_now(&mut self, e: usize)

The field’s message 4 in state 10: harvest now.

Original: FUN_14011f3d0.

Source

pub fn crop_message(&mut self, e: usize, message: i32, index: i32)

CropFieldComponent’s message slot. Message 0: cell index was planted (its crop keeps the cell’s pile flag, NaturalResource); message 1: a tending visit advances the cell’s crop by growing time × 300 s × tend.

Original: FUN_140120020.

Source§

impl Sim<'_, '_>

Source

pub fn plant(&mut self, template: usize, cell: i32)

CreateNaturalResource’s start once the cell was found free.

Source§

impl Sim<'_, '_>

Source

pub fn update_hunts(&mut self, visits: &[(usize, i64)])

HuntComponent’s scheduled update: the hunting time grows by the elapsed time times the workers over the most allowed.

Original: FUN_140127c10.

Source§

impl Sim<'_, '_>

Source

pub fn orchard_clear_now(&mut self, e: usize)

Message 5: clear the orchard (0x14).

Original: FUN_140051d40.

Source

pub fn orchard_harvest_now(&mut self, e: usize)

Message 4: harvest now; nothing is picked yet this harvest.

Original: FUN_140051260.

Source

pub fn orchard_message(&mut self, e: usize, message: i32, index: i32)

OrchardComponent’s message slot. 0: slot index was planted (a tree with fruit stands, else it is lost); 1: the tree was picked (its fruit starts again); 2: a tending visit ripens its fruit by ripening time × 300 s × tend.

Original: FUN_1400522f0.

Source

pub fn orchard_action(&mut self, e: usize, action: i32)

The orchard’s buttons: 0 plant now (message 3, state 2), 1 harvest now (message 4, states 10 and 12), 2 tending on/off, 3 clear (message 5, states 9–12).

Original: FUN_140052500.

Source

pub fn set_orchard_tree(&mut self, e: usize, tree: Option<usize>)

The orchard’s tree list (as CropUI’s slot): choosing the first tree switches tending on.

Source§

impl Sim<'_, '_>

Source

pub fn pasture_message(&mut self, e: usize, message: i32)

The pasture’s message 0: a rancher’s visit.

Original: FUN_14012cbf0.

Source

pub fn set_pasture_kind( &mut self, jobs: &mut Jobs, e: usize, kind: Option<usize>, )

PastureUI slot: the kind of animal; choosing the first one switches the work on. The most it keeps becomes its room.

Original: FUN_1400ba110.

Source

pub fn set_pasture_limit(&mut self, e: usize, limit: i32)

PastureUI slot: the slider sets the most animals kept.

Original: FUN_1400ba2f0.

Source

pub fn pasture_query(&self, e: usize, query: i32) -> u8

Whether the window’s button query is available. 0 (send every animal away) needs room for all of them in other pastures of the kind, 1 (send half) ten animals and room for five; 2 is the work toggle’s state (bit 2 on).

Original: FUN_14012d2a0.

Source

pub fn pasture_action(&mut self, jobs: &mut Jobs, e: usize, action: i32)

2 switches the work on or off; 0 sends every animal (1 half of them, rounded down) to other pastures of the kind, the roomiest first.

Original: FUN_14012cf30.

Source§

impl Sim<'_, '_>

Source

pub fn clear_remaining(&self, e: usize) -> i32

The footprint cells holding another object.

Original: FUN_14011d800.

Source

pub fn unclaim(&mut self, resource: usize)

A removal sequence was aborted.

Original: FUN_1400cff70.

Source

pub fn animate_resource(&mut self, resource: usize, anim: usize)

A resource with the animation flag plays clip anim.

Original: FUN_14012b910.

Source

pub fn remove_resource( &mut self, c: usize, resource: usize, educated: bool, priority: Option<i32>, auto_pickup: bool, )

The start of RemoveNaturalResource: queue the resource for removal; unless another profession should have harvested it, leave a pile of yield × min(growth, 1) units (the educated yield for educated citizens), turned RandTol(2) × 90°. priority is the priority of a work at the resource’s cell.

Original: FUN_1400cffe0, FUN_1400fe220, FUN_14012b5c0.

Source§

impl Sim<'_, '_>

Source

pub fn workers(&self) -> Vec<Worker>

Each citizen’s worker state.

Source

pub fn set_workers(&mut self, workers: &[Worker])

Set each citizen’s worker state.

Source§

impl Sim<'_, '_>

Source

pub fn activate_piles(&mut self, jobs: &mut Jobs)

RawMaterialComponent activation: register each new pile’s Pickup work.

Original: FUN_14012e6a0.

Source

pub fn destroy_pile(&mut self, jobs: &mut Jobs, id: usize)

Destroy a pile (picked up or decayed): its entity, its cell and its work.

Source

pub fn take_pile(&mut self, jobs: &mut Jobs, c: usize, id: usize)

PickupRawMaterial start: the pile goes into the carried storage.

Original: FUN_1400ceda0.

Source

pub fn age_piles(&mut self, jobs: &mut Jobs, visits: &[(usize, i64)])

The scheduled update of the piles visited this iteration: piles older than an hour disappear.

Original: FUN_14012e600.

Source§

impl Sim<'_, '_>

Source

pub fn activate(&mut self, jobs: &mut Jobs, entity: usize)

Activate a site placed since the last iteration.

Original: FUN_1400c9d70, then the activation.

Source

pub fn update_sites( &mut self, jobs: &mut Jobs, dt: i64, visits: &[(usize, i64)], )

The sites’ StateMachine updates: every site’s bit-4 update with the iteration’s time dt, then the scheduled update of each site its bucket visited this iteration (visits, in visiting order) with the time since its last visit.

Original: FUN_1400c9560.

Source

pub fn destroy_entity(&mut self, jobs: &mut Jobs, e: usize)

The entity manager’s removal of a destroyed site entity (then each component’s remove slot): its work goes (citizens doing it abort), the ZoneComponent frees its cells and the entity is gone.

Original: FUN_1400c8370.

Source§

impl Sim<'_, '_>

Source

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

Carry everything to storages that take it: one drop-off per storage (nearest found per material, reusing a storage already chosen), then a final drop-off of whatever is left.

Original: FUN_14011b330.

Source§

impl Sim<'_, '_>

Source

pub fn residence_clear_storage( &mut self, jobs: &mut Jobs, visits: &[(usize, i64)], )

The residence update’s work: a house nobody lives in that still holds goods gets a ClearStorage work (mask 1); an empty storage has it removed.

Original: FUN_14012ee40.

Source§

impl Sim<'_, '_>

Source

pub fn control(&mut self, jobs: &mut Jobs, e: usize, kind: u32, index: i32)

Slot of the kind component of e, control index.

Source§

impl Sim<'_, '_>

Source

pub fn is_damaged(&self, e: usize) -> bool

Damaged (6) or rubble (7).

Original: FUN_140123b60.

Source

pub fn is_demolishing(&self, e: usize) -> bool

Being torn down (3 to 5).

Original: FUN_140123be0.

Source

pub fn demolish(&mut self, jobs: &mut Jobs, e: usize)

Remove Buildings and the demolish button. Damaged or rubble: clear it (message 1); else the machine runs what is pending, then goes to 3.

Original: FUN_140123470.

Source

pub fn upgrade(&mut self, jobs: &mut Jobs, e: usize, template: usize)

UpgradeUI’s button: the replacement is template, and the building is torn down.

Original: FUN_14008c160, FUN_140123470.

Source

pub fn cancel_demolition(&mut self, jobs: &mut Jobs, e: usize)

DestroyUI’s cancel (0x1771): message 0, and the replacement goes back to the description’s.

Original: FUN_1401238d0.

Source

pub fn damage(&mut self, jobs: &mut Jobs, e: usize, time: i64) -> bool

Damage for time (fire, the tornado). A building not started yet takes none; else it goes to 3 (then 6).

Original: FUN_140123c80.

Source

pub fn to_rubble(&mut self, jobs: &mut Jobs, e: usize)

Straight to rubble.

Original: FUN_140123ee0.

Source

pub fn destroy_message(&mut self, jobs: &mut Jobs, e: usize, msg: i32)

The StateMachine’s message slot for the Destroy states: the current state’s handler.

Source§

impl Sim<'_, '_>

Source

pub fn plan_road( &mut self, jobs: &mut Jobs, cell: i32, kind: u8, ty: u8, material: Option<usize>, )

Plan a better road (a lower kind) than the cell has: a plan already there is taken back; a cell that is neither road (types 0, 1) nor planned counts one more; a BuildRoad work is registered, and the cell keeps the new kind while it is built.

Original: FUN_1400a1e30(cell, kind, type, material).

Source

pub fn unplan_road(&mut self, jobs: &mut Jobs, cell: i32) -> bool

A planned road’s work goes and the cell gets back what it had (true); a cell without a road kind becomes ground at once (false); a road built stays (true, for the caller to clear).

Original: FUN_1400a1bd0.

Source

pub fn complete_road(&mut self, cell: i32, built: u8, ty: u8)

The start of CompleteRoad: to ground (type 2) the cell loses its road (one less, no kind); else it becomes the road type. Either way it leaves the planned set. A road flattens the terrain at its cell’s corners; the road decals follow road_revision.

Original: FUN_1400a1b10(cell, kind byte, type); FUN_1400a35b0, FUN_1400b4840.

Trait Implementations§

Source§

impl Callbacks for Sim<'_, '_>

Source§

fn machine(&mut self, site: usize) -> &mut Machine

A site’s state machine.
Source§

fn call(&mut self, jobs: &mut Jobs, e: usize, f: Callback) -> bool

Run a callback. Returns false to pass the state on to the previous controller.
Source§

impl WorkHost for Sim<'_, '_>

Source§

fn refresh(&mut self, work: &mut Work)

FUN_1400f1020 / FUN_1400ea0b0.

Source§

fn cancel(&mut self, work: &mut Work)

FUN_1400f1950 / FUN_1400eac70: clear every worker’s stack (their aborts leave the set through the fail slot).

Source§

fn profession(&self, c: usize) -> usize

Citizen +0x1f0, +0x248, the character’s cell, and FUN_14011b0b0.
Source§

fn workplace(&self, c: usize) -> Option<usize>

The citizen’s workplace.
Source§

fn cell(&self, c: usize) -> i32

The citizen’s map cell.
Source§

fn has_emergency(&self, c: usize) -> bool

Whether there is an emergency near the citizen.
Source§

fn works_anywhere(&self, p: usize) -> bool

Profession +0x4c.
Source§

fn rank(&mut self, a: i32, b: i32) -> i32

FUN_1400a4ce0(map, a, b, 1), with the callers’ fallback n + (int)sqrtf(d²).
Source§

fn stock(&self, slot: usize) -> (i32, i32)

The stock manager’s (count, limit) per slot (Game +0xf0 → +0x170).
Source§

fn laborer(&self) -> usize

The laborer and builder professions (Game +0xb0 → +0x30/+0x38).
Source§

fn builder(&self) -> usize

The builder profession.
Source§

fn rng(&mut self) -> &mut Random

The game’s random numbers.
Source§

fn take_events(&mut self) -> Vec<JobEvent>

Job messages raised while the host ran a slot (aborted CompleteTasks of other works), for the manager to deliver: (work, citizen, param, completed).
Source§

fn try_assign(&mut self, work: &mut Work, c: usize, time: i64) -> u8

Slot +0x20: 0 cannot, 1 not now, 2 assigned. time is the manager’s clock +0x130.
Source§

fn take_offers(&mut self) -> Vec<i32>

Works a slot +0x20 asked the manager to offer in its place (FUN_1400fdaf0 called from inside a try, as ClearArea does with the piles in its footprint), in order. A try answering NESTED has queued them.
Source§

fn offers_again(&mut self) -> bool

The queued offers get a second try (FUN_1400fdaf0(.., 1)).
Source§

fn resume(&mut self, work: &mut Work, c: usize) -> u8

After a NESTED answer none of whose offers was taken: the rest of the try (ConsumeProduce goes on to work a cycle).
Source§

fn complete(&mut self, work: &mut Work, c: usize, param: i32) -> bool

Slot +0x30: a CompleteTask finished; true removes the work.
Source§

fn fail(&mut self, work: &mut Work, c: usize, param: i32)

Slot +0x38: a CompleteTask was aborted.
Source§

fn try_assign_again( &mut self, _work: &mut Work, _citizen: usize, _time: i64, ) -> bool

Slot +0x28 (the base returns false).

Auto Trait Implementations§

§

impl<'s, 't> !UnwindSafe for Sim<'s, 't>

§

impl<'s, 't> Freeze for Sim<'s, 't>

§

impl<'s, 't> RefUnwindSafe for Sim<'s, 't>

§

impl<'s, 't> Send for Sim<'s, 't>

§

impl<'s, 't> Sync for Sim<'s, 't>

§

impl<'s, 't> Unpin for Sim<'s, 't>

§

impl<'s, 't> UnsafeUnpin for Sim<'s, 't>

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.