pub struct GameState {Show 31 fields
pub references: BTreeMap<u32, String>,
pub climate: u32,
pub start_condition: u32,
pub terrain: u32,
pub seed: u32,
pub size: i32,
pub flags: u32,
pub scenario: i32,
pub random_index: u32,
pub random_state: Vec<u32>,
pub town_name: String,
pub goal_done: bool,
pub goal: Option<ObjId>,
pub entity_time: i64,
pub entities: Vec<Option<ObjId>>,
pub buckets: Vec<Vec<Option<ObjId>>>,
pub bucket_values: [[i32; 5]; 2],
pub schedules: Vec<(i32, i32, i32, i64)>,
pub version: u32,
pub wide_strings: bool,
pub persist_state: Vec<u8>,
pub entity_manager_version: u32,
pub achievements: Fields,
pub animations: Vec<u8>,
pub audio_scene: Vec<u8>,
pub camera: Option<SceneCamera>,
pub terrain_map: Option<MapComponent>,
pub town: Fields,
pub map: GameMap,
pub managers: Fields,
pub objects: BTreeMap<ObjId, Object>,
}Expand description
The whole game state.
Fields§
§references: BTreeMap<u32, String>The external reference table (ExternalFactory::SerializeReferenceTable).
climate: u32The climate.
start_condition: u32The start condition.
terrain: u32The terrain type.
seed: u32The map seed.
size: i32The map size.
flags: u32The game’s flags.
scenario: i32The scenario.
random_index: u32The index of the game’s Random (System::Random::Serialize).
random_state: Vec<u32>The 624 words of the game’s Random.
town_name: StringThe town’s name.
goal_done: boolThe goal’s state.
goal: Option<ObjId>The goal, if any.
entity_time: i64The entity manager’s clock.
Original: FUN_1400c9970, FUN_140022500.
entities: Vec<Option<ObjId>>The entities.
buckets: Vec<Vec<Option<ObjId>>>The scheduler’s five bucket lists.
bucket_values: [[i32; 5]; 2]The scheduler’s two five-int arrays.
schedules: Vec<(i32, i32, i32, i64)>Each entity’s schedule (the low 24 bits; the time).
version: u32The game loop serializer’s version (3 in the samples).
wide_strings: boolThe strings were written as UTF-16 (2015 builds) rather than 8-bit.
persist_state: Vec<u8>InternalFactory::ResetPersistState’s block, as written.
entity_manager_version: u32The entity manager block’s version.
achievements: FieldsAchievementManager::Persist: the achievement instances.
animations: Vec<u8>The animations: a whole block (markers included) carried through undecoded. An empty one
(a new game) is written as the engine’s empty state (empty_animations).
audio_scene: Vec<u8>The sound scene: a whole block carried through undecoded. An empty one is written as the engine’s empty state (empty_audio_scene).
camera: Option<SceneCamera>The game camera.
Original: FUN_14009dd90.
terrain_map: Option<MapComponent>The terrain.
Original: FUN_1400b59a0.
town: FieldsThe town manager.
Original: FUN_140094c30.
map: GameMapThe gameplay map.
Original: FUN_1400a45d0.
managers: FieldsThe blocks after the map: jobs, tools, calendar, event_log, environment and
minimap (see savegame_schema).
objects: BTreeMap<ObjId, Object>Every object in the stream, by number.
Implementations§
Source§impl GameState
impl GameState
Sourcepub fn new_object(&mut self, name: &'static str) -> Option<ObjId>
pub fn new_object(&mut self, name: &'static str) -> Option<ObjId>
A new object of type name with default fields (crate::savegame_schema::default_fields)
and the next free factory index. The tag (Internal, drawn on the factory’s own Random in
the original) is the index here; returns its id.