pub enum GitObjects<S, T> {
Static(Vec<S>),
Saved(Vec<T>),
}Expand description
The two forms an object list in a GIT can take.
UseTemplates decides which, for every object list at once. A module’s
static .git sets it to 1: each element is a sparse placement carrying
a TemplateResRef, and the engine loads the matching blueprint and
overlays the instance fields the element holds. A savegame GIT leaves it
at 0, and each element is a full self-contained snapshot read field by
field, with no template to resolve. A field missing from a saved element
falls back to the engine’s hardcoded default rather than to a blueprint
value.
The flag is not kept as a separate field on Git, because it describes
exactly this choice and storing both would let them disagree.
§Three lists are not one of these
Waypoints, because LoadWaypoints ignores UseTemplates and always
reads inline data, so there is nothing to select between. Area effects,
because no loader in the binary opens a template for one, so that list is
only ever the saved form. Encounters, because their saved field set is
not modelled yet; see Git::encounters for why.
Variants§
Static(Vec<S>)
UseTemplates = 1: sparse placements referencing blueprints.
Saved(Vec<T>)
UseTemplates = 0: full snapshots, as a savegame stores them.
Implementations§
Source§impl<S, T> GitObjects<S, T>
impl<S, T> GitObjects<S, T>
Sourcepub fn uses_templates(&self) -> bool
pub fn uses_templates(&self) -> bool
Returns whether this list references blueprints rather than carrying
snapshots, which is what UseTemplates records.
Sourcepub fn as_static(&self) -> Option<&[S]>
pub fn as_static(&self) -> Option<&[S]>
Returns the static placements, or None when the list is saved content.
Sourcepub fn as_saved(&self) -> Option<&[T]>
pub fn as_saved(&self) -> Option<&[T]>
Returns the saved snapshots, or None when the list is static content.
Sourcepub fn as_static_mut(&mut self) -> Option<&mut Vec<S>>
pub fn as_static_mut(&mut self) -> Option<&mut Vec<S>>
Mutable view of the static placements, or None for saved content.
Sourcepub fn as_saved_mut(&mut self) -> Option<&mut Vec<T>>
pub fn as_saved_mut(&mut self) -> Option<&mut Vec<T>>
Mutable view of the saved snapshots, or None for static content.
Trait Implementations§
Source§impl<S: Clone, T: Clone> Clone for GitObjects<S, T>
impl<S: Clone, T: Clone> Clone for GitObjects<S, T>
Source§fn clone(&self) -> GitObjects<S, T>
fn clone(&self) -> GitObjects<S, T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<S, T> Default for GitObjects<S, T>
impl<S, T> Default for GitObjects<S, T>
Source§impl<S: PartialEq, T: PartialEq> PartialEq for GitObjects<S, T>
impl<S: PartialEq, T: PartialEq> PartialEq for GitObjects<S, T>
Source§fn eq(&self, other: &GitObjects<S, T>) -> bool
fn eq(&self, other: &GitObjects<S, T>) -> bool
self and other values to be equal, and is used by ==.