pub struct GameState {Show 14 fields
characters: HashMap<u32, Shared<GameObjectEntity<Character>>>,
titles: HashMap<u32, Shared<GameObjectEntity<Title>>>,
faiths: HashMap<u32, Shared<GameObjectEntity<Faith>>>,
cultures: HashMap<u32, Shared<GameObjectEntity<Culture>>>,
dynasties: HashMap<u32, Shared<GameObjectEntity<Dynasty>>>,
houses: HashMap<u32, Shared<GameObjectEntity<House>>>,
memories: HashMap<u32, Shared<GameObjectEntity<Memory>>>,
artifacts: HashMap<u32, Shared<GameObjectEntity<Artifact>>>,
traits_lookup: Vec<Rc<str>>,
contract_transform: HashMap<u32, Shared<Option<Shared<GameObjectEntity<Character>>>>>,
character_transform: HashMap<u32, u32>,
county_data: HashMap<String, (Shared<GameObjectEntity<Faith>>, Shared<GameObjectEntity<Culture>>)>,
current_date: Option<Date>,
offset_date: Option<Date>,
}
Expand description
A struct representing all known game objects. It is guaranteed to always return a reference to the same object for the same key. Naturally the value of that reference may change as values are added to the game state. This is mainly used during the process of gathering data from the parsed save file.
Fields§
§characters: HashMap<u32, Shared<GameObjectEntity<Character>>>
A character id->Character transform
titles: HashMap<u32, Shared<GameObjectEntity<Title>>>
A title id->Title transform
faiths: HashMap<u32, Shared<GameObjectEntity<Faith>>>
A faith id->Title transform
cultures: HashMap<u32, Shared<GameObjectEntity<Culture>>>
A culture id->Culture transform
dynasties: HashMap<u32, Shared<GameObjectEntity<Dynasty>>>
A dynasty id->Dynasty transform
houses: HashMap<u32, Shared<GameObjectEntity<House>>>
§memories: HashMap<u32, Shared<GameObjectEntity<Memory>>>
A memory id->Memory transform
artifacts: HashMap<u32, Shared<GameObjectEntity<Artifact>>>
A artifact id->Artifact transform
traits_lookup: Vec<Rc<str>>
A trait id->Trait identifier transform
contract_transform: HashMap<u32, Shared<Option<Shared<GameObjectEntity<Character>>>>>
A vassal contract id->Character transform
character_transform: HashMap<u32, u32>
§county_data: HashMap<String, (Shared<GameObjectEntity<Faith>>, Shared<GameObjectEntity<Culture>>)>
§current_date: Option<Date>
The current date from the meta section
offset_date: Option<Date>
The time Y.M.D from which the game started
Implementations§
Source§impl GameState
impl GameState
Sourcepub fn add_lookup(&mut self, array: Vec<Rc<str>>)
pub fn add_lookup(&mut self, array: Vec<Rc<str>>)
Add a lookup table for traits
pub fn add_character_transform(&mut self, transform: HashMap<u32, u32>)
Sourcepub fn set_current_date(&mut self, date: Date, offset: Date)
pub fn set_current_date(&mut self, date: Date, offset: Date)
Set the current date
Sourcepub fn get_current_date(&self) -> Option<Date>
pub fn get_current_date(&self) -> Option<Date>
Get the current date
Sourcepub fn get_character(
&mut self,
key: &u32,
) -> Shared<GameObjectEntity<Character>>
pub fn get_character( &mut self, key: &u32, ) -> Shared<GameObjectEntity<Character>>
Get a character by key
Sourcepub fn get_vassal(
&mut self,
contract_id: &u32,
) -> Shared<Option<Shared<GameObjectEntity<Character>>>>
pub fn get_vassal( &mut self, contract_id: &u32, ) -> Shared<Option<Shared<GameObjectEntity<Character>>>>
Gets the vassal associated with the contract with the given id
Sourcepub fn add_contract(&mut self, contract_id: &u32, character_id: &u32)
pub fn add_contract(&mut self, contract_id: &u32, character_id: &u32)
Adds a new vassal contract
Sourcepub fn get_culture(&mut self, key: &u32) -> Shared<GameObjectEntity<Culture>>
pub fn get_culture(&mut self, key: &u32) -> Shared<GameObjectEntity<Culture>>
Get a culture by key
Sourcepub fn get_dynasty(&mut self, key: &u32) -> Shared<GameObjectEntity<Dynasty>>
pub fn get_dynasty(&mut self, key: &u32) -> Shared<GameObjectEntity<Dynasty>>
Get a dynasty by key
Sourcepub fn get_memory(&mut self, key: &u32) -> Shared<GameObjectEntity<Memory>>
pub fn get_memory(&mut self, key: &u32) -> Shared<GameObjectEntity<Memory>>
Get a memory by key
Sourcepub fn get_artifact(&mut self, key: &u32) -> Shared<GameObjectEntity<Artifact>>
pub fn get_artifact(&mut self, key: &u32) -> Shared<GameObjectEntity<Artifact>>
Get an artifact by key
pub fn get_house(&mut self, key: &u32) -> Shared<GameObjectEntity<House>>
pub fn add_house( &mut self, key: &u32, value: &HashMap<String, SaveFileValue>, ) -> Result<(), ParsingError>
pub fn add_artifact( &mut self, key: &u32, value: &HashMap<String, SaveFileValue>, ) -> Result<(), ParsingError>
Sourcepub fn add_character(
&mut self,
key: &u32,
value: &HashMap<String, SaveFileValue>,
) -> Result<(), ParsingError>
pub fn add_character( &mut self, key: &u32, value: &HashMap<String, SaveFileValue>, ) -> Result<(), ParsingError>
Add a character to the game state
Sourcepub fn add_title(
&mut self,
key: &u32,
value: &HashMap<String, SaveFileValue>,
) -> Result<(), ParsingError>
pub fn add_title( &mut self, key: &u32, value: &HashMap<String, SaveFileValue>, ) -> Result<(), ParsingError>
Add a title to the game state
Sourcepub fn add_faith(
&mut self,
key: &u32,
value: &HashMap<String, SaveFileValue>,
) -> Result<(), ParsingError>
pub fn add_faith( &mut self, key: &u32, value: &HashMap<String, SaveFileValue>, ) -> Result<(), ParsingError>
Add a faith to the game state
Sourcepub fn add_culture(
&mut self,
key: &u32,
value: &HashMap<String, SaveFileValue>,
) -> Result<(), ParsingError>
pub fn add_culture( &mut self, key: &u32, value: &HashMap<String, SaveFileValue>, ) -> Result<(), ParsingError>
Add a culture to the game state
Sourcepub fn add_dynasty(
&mut self,
key: &u32,
value: &HashMap<String, SaveFileValue>,
) -> Result<(), ParsingError>
pub fn add_dynasty( &mut self, key: &u32, value: &HashMap<String, SaveFileValue>, ) -> Result<(), ParsingError>
Add a dynasty to the game state
Sourcepub fn add_memory(
&mut self,
key: &u32,
value: &HashMap<String, SaveFileValue>,
) -> Result<(), ParsingError>
pub fn add_memory( &mut self, key: &u32, value: &HashMap<String, SaveFileValue>, ) -> Result<(), ParsingError>
Add a memory to the game state
pub fn get_baronies_of_counties<F: Fn(&Title) -> bool>( &self, filter: F, ) -> Vec<Rc<str>>
pub fn add_county_data( &mut self, county_data: HashMap<String, (Shared<GameObjectEntity<Faith>>, Shared<GameObjectEntity<Culture>>)>, )
pub fn new_grapher(&self) -> Grapher
pub fn new_timeline(&self) -> Timeline
Trait Implementations§
Auto Trait Implementations§
impl Freeze for GameState
impl !RefUnwindSafe for GameState
impl !Send for GameState
impl !Sync for GameState
impl Unpin for GameState
impl !UnwindSafe for GameState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.