pub trait WorkHost {
Show 20 methods
// Required methods
fn profession(&self, citizen: usize) -> usize;
fn workplace(&self, citizen: usize) -> Option<usize>;
fn cell(&self, citizen: usize) -> i32;
fn has_emergency(&self, citizen: usize) -> bool;
fn works_anywhere(&self, profession: usize) -> bool;
fn rank(&mut self, a: i32, b: i32) -> i32;
fn stock(&self, slot: usize) -> (i32, i32);
fn laborer(&self) -> usize;
fn builder(&self) -> usize;
fn rng(&mut self) -> &mut Random;
fn refresh(&mut self, work: &mut Work);
fn try_assign(&mut self, work: &mut Work, citizen: usize, time: i64) -> u8;
fn complete(&mut self, work: &mut Work, citizen: usize, param: i32) -> bool;
fn fail(&mut self, work: &mut Work, citizen: usize, param: i32);
fn cancel(&mut self, work: &mut Work);
// Provided methods
fn try_assign_again(
&mut self,
_work: &mut Work,
_citizen: usize,
_time: i64,
) -> bool { ... }
fn take_events(&mut self) -> Vec<JobEvent> { ... }
fn take_offers(&mut self) -> Vec<i32> { ... }
fn offers_again(&mut self) -> bool { ... }
fn resume(&mut self, _work: &mut Work, _citizen: usize) -> u8 { ... }
}Expand description
The citizen and world queries and the work slots the manager calls.
Required Methods§
Sourcefn profession(&self, citizen: usize) -> usize
fn profession(&self, citizen: usize) -> usize
Citizen +0x1f0, +0x248, the character’s cell, and FUN_14011b0b0.
Sourcefn has_emergency(&self, citizen: usize) -> bool
fn has_emergency(&self, citizen: usize) -> bool
Whether there is an emergency near the citizen.
Sourcefn works_anywhere(&self, profession: usize) -> bool
fn works_anywhere(&self, profession: usize) -> bool
Profession +0x4c.
Sourcefn rank(&mut self, a: i32, b: i32) -> i32
fn rank(&mut self, a: i32, b: i32) -> i32
FUN_1400a4ce0(map, a, b, 1), with the callers’ fallback n + (int)sqrtf(d²).
Sourcefn stock(&self, slot: usize) -> (i32, i32)
fn stock(&self, slot: usize) -> (i32, i32)
The stock manager’s (count, limit) per slot (Game +0xf0 → +0x170).
Sourcefn refresh(&mut self, work: &mut Work)
fn refresh(&mut self, work: &mut Work)
Slot +0x48: refresh (drop workers that no longer hold this work’s task).
Sourcefn try_assign(&mut self, work: &mut Work, citizen: usize, time: i64) -> u8
fn try_assign(&mut self, work: &mut Work, citizen: usize, time: i64) -> u8
Slot +0x20: 0 cannot, 1 not now, 2 assigned. time is the manager’s clock +0x130.
Sourcefn complete(&mut self, work: &mut Work, citizen: usize, param: i32) -> bool
fn complete(&mut self, work: &mut Work, citizen: usize, param: i32) -> bool
Slot +0x30: a CompleteTask finished; true removes the work.
Sourcefn fail(&mut self, work: &mut Work, citizen: usize, param: i32)
fn fail(&mut self, work: &mut Work, citizen: usize, param: i32)
Slot +0x38: a CompleteTask was aborted.
Sourcefn cancel(&mut self, work: &mut Work)
fn cancel(&mut self, work: &mut Work)
Slot +0x40: clear every worker’s action stack (their CompleteTask aborts call
WorkHost::fail on this work, which the host handles directly).
Provided Methods§
Sourcefn try_assign_again(
&mut self,
_work: &mut Work,
_citizen: usize,
_time: i64,
) -> bool
fn try_assign_again( &mut self, _work: &mut Work, _citizen: usize, _time: i64, ) -> bool
Slot +0x28 (the base returns false).
Sourcefn take_events(&mut self) -> Vec<JobEvent>
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).
Sourcefn take_offers(&mut self) -> Vec<i32>
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.
Sourcefn offers_again(&mut self) -> bool
fn offers_again(&mut self) -> bool
The queued offers get a second try (FUN_1400fdaf0(.., 1)).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".