Skip to main content

Jobs

Struct Jobs 

Source
pub struct Jobs {
    pub pass: i32,
    pub works: BTreeMap<i32, Work>,
    pub time: i64,
    /* private fields */
}
Expand description

The manager.

Fields§

§pass: i32

Pass counter (one per simulation iteration).

Original: FUN_14009b850.

§works: BTreeMap<i32, Work>

Id → work.

§time: i64

Manager clock (ticks), advanced with the pass.

Implementations§

Source§

impl Jobs

Source

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

One simulation iteration of the job manager.

Original: FUN_1400fe650, and the step in FUN_14009b850.

Source

pub fn is_empty(&self) -> bool

Whether there is no work.

Source

pub fn add(&mut self, work: Work, mask: u32, keep: Option<i32>) -> i32

Register a work. With keep, the work gets that priority (moved down past any value already taken), else the next one in sequence. Returns the work’s id.

Original: FUN_1400fdd70(work, mask, keep, priority).

Source

pub fn restore( &mut self, next_id: i32, next_priority: i32, pass: i32, works: impl IntoIterator<Item = (Work, Vec<u32>)>, professions: &[usize], )

A saved manager: its counters, then each work with the categories it was filed under (1..14), and the professions its profession map holds. The priority index is rebuilt from the works’ own priorities, as the load pass does; the clock is not saved and restarts at 0.

Original: FUN_1400fe710.

Source

pub fn counters(&self) -> (i32, i32)

The counters a save holds.

Source

pub fn category(&self, c: u32) -> Vec<i32>

The works filed under category c (1..14), in id order.

Source

pub fn by_profession(&self) -> Vec<(usize, Vec<i32>)>

The works by profession, in profession then id order.

Source

pub fn remove(&mut self, id: i32, host: &mut impl WorkHost)

Unregister, refresh, cancel every worker, delete.

Original: FUN_1400fe300.

Source

pub fn drain(&mut self, host: &mut impl WorkHost)

Deliver the host’s pending job events in order.

Source

pub fn prioritize(&mut self, id: i32)

Move a work to the front (lowest priority − 1).

Original: FUN_1400fefa0.

Source

pub fn change_profession(&mut self, id: i32, from: usize, to: usize)

Move a work from one profession’s list to another’s.

Original: FUN_1400fd8d0.

Source

pub fn complete( &mut self, id: i32, citizen: usize, param: i32, host: &mut impl WorkHost, )

A task finished (the start of CompleteTask): remove the work when its slot says it is done.

Original: FUN_1400fdc30.

Source

pub fn fail( &mut self, id: i32, citizen: usize, param: i32, host: &mut impl WorkHost, )

A task failed (CompleteTask cancelled).

Original: FUN_1400fdcd0.

Source

pub fn offer_one( &mut self, id: i32, citizen: usize, again: bool, host: &mut impl WorkHost, ) -> bool

Offer one work by id, with a second try when the first answers “not now” and again is set.

Original: FUN_1400fdaf0.

Source

pub fn assign_work(&mut self, citizen: usize, host: &mut impl WorkHost)

Give a citizen work: activity 9.

Original: FUN_1400fcd00.

Source

pub fn assign_emergency( &mut self, citizen: usize, host: &mut impl WorkHost, ) -> bool

Give a citizen emergency work (activity 2), for example fighting a fire. Returns whether there was some.

Original: FUN_1400fca20.

Trait Implementations§

Source§

impl Clone for Jobs

Source§

fn clone(&self) -> Jobs

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Jobs

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Jobs

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl Freeze for Jobs

§

impl RefUnwindSafe for Jobs

§

impl Send for Jobs

§

impl Sync for Jobs

§

impl Unpin for Jobs

§

impl UnsafeUnpin for Jobs

§

impl UnwindSafe for Jobs

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.