Skip to main content

Trade

Struct Trade 

Source
pub struct Trade {
    pub mode: i32,
    pub merchant: i32,
    pub orders: Vec<Order>,
    pub automatic: Vec<(u32, i32, i32)>,
    pub offers: Vec<Offer>,
    pub keep: BTreeMap<usize, i32>,
    pub working: bool,
    pub held: bool,
    pub timer: i64,
    pub boat: Option<usize>,
}
Expand description

TradeComponent: when it trades by itself (0 never, 1 when a merchant arrives, 2 when it leaves), the merchant docked (−1), the orders by merchant, the automatic trades by category (flags, index, amount), the merchant’s goods, the goods to keep at the post by raw material, TradeWork on, held (the trade window is open), the time to the next merchant or until it leaves, the boat.

Fields§

§mode: i32

When it trades by itself: 0 never, 1 when a merchant arrives, 2 when it leaves.

§merchant: i32

The merchant docked (−1 none).

§orders: Vec<Order>

The orders, by merchant.

§automatic: Vec<(u32, i32, i32)>

The automatic trades by category: (flags, index, amount).

§offers: Vec<Offer>

The merchant’s goods.

§keep: BTreeMap<usize, i32>

The goods to keep at the post, by raw material.

§working: bool

Whether the post’s hauling work is on.

§held: bool

Whether the trade window is open.

§timer: i64

The time to the next merchant, or until it leaves.

§boat: Option<usize>

The boat, if any.

Implementations§

Source§

impl Trade

Source

pub fn new( t: &TradeTemplate, rng: &mut Random, names: Option<&(NameDatabase, NameDatabase)>, ) -> Trade

The activation: every merchant a name (Rand(2) picks the sex) and no order; every category no automatic trade.

Original: FUN_14005cb80.

Trait Implementations§

Source§

impl Clone for Trade

Source§

fn clone(&self) -> Trade

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 Trade

Source§

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

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

impl Default for Trade

Source§

fn default() -> Trade

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

impl Eq for Trade

Source§

impl PartialEq for Trade

Source§

fn eq(&self, other: &Trade) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Trade

Auto Trait Implementations§

§

impl Freeze for Trade

§

impl RefUnwindSafe for Trade

§

impl Send for Trade

§

impl Sync for Trade

§

impl Unpin for Trade

§

impl UnsafeUnpin for Trade

§

impl UnwindSafe for Trade

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.