Struct aoe2_probe::Scenario
source · [−]pub struct Scenario {
pub versio: Token,
/* private fields */
}
Fields
versio: Token
Implementations
sourceimpl Scenario
impl Scenario
sourcepub fn from_file(filename: &str) -> Self
pub fn from_file(filename: &str) -> Self
Read scenario data from the given file. Please check the github homepage for the version support status. Generally, ver.1.46 and above are well supported.
Examples
use aoe2_probe::Scenario;
let scenario = Scenario::from_file("./resources/chapter_1.aoe2scenario");
sourcepub fn from_le_vec(buffer: Vec<u8>) -> Self
pub fn from_le_vec(buffer: Vec<u8>) -> Self
Read scenario data from the given little endian buffer.
Examples
use aoe2_probe::Scenario;
//Encode a scenario to a little endian vector of uint8
let source_scenario = Scenario::from_file("./resources/chapter_1.aoe2scenario");
let buffer = source_scenario.to_le_export_vec();
//Decode a scenario from a little endian vector of uint8
let scenario = Scenario::from_le_vec(buffer);
sourcepub fn to_le_vec(self) -> Vec<u8>
pub fn to_le_vec(self) -> Vec<u8>
Encode a scenario struct to little endian vector of uint8 If you want to generate an .aoe2scenario file, then this function are not recommended. The whole .aoe2scenario except file header part are compressed. The bytes generated by this function are raw uncompressed. See function to_export_le_vec for compressed bytes.
Examples
use aoe2_probe::Scenario;
//Encode a scenario to a little endian vector of uint8
let source_scenario = Scenario::from_file("./resources/chapter_1.aoe2scenario");
let buffer = source_scenario.to_le_vec();
sourcepub fn to_le_export_vec(self) -> Vec<u8>
pub fn to_le_export_vec(self) -> Vec<u8>
Encode a scenario struct to little endian vector of uint8 that can be read by AoE2 DE
Examples
use aoe2_probe::Scenario;
//Encode a scenario to a little endian vector of uint8
let source_scenario = Scenario::from_file("./resources/chapter_1.aoe2scenario");
let buffer = source_scenario.to_le_export_vec();
sourcepub fn to_file(self, file_path: &str)
pub fn to_file(self, file_path: &str)
Save the given scenario to the given path. The path will be created if not existed.
Examples
use aoe2_probe::Scenario;
let source_scenario = Scenario::from_file("./resources/chapter_1.aoe2scenario");
let buffer = source_scenario.to_file("./resources/temp.aoe2scenario");
sourcepub fn triggers_proxy(&mut self) -> TriggersProxy<'_>
pub fn triggers_proxy(&mut self) -> TriggersProxy<'_>
Return a TriggerProxy struct that contains several helper functions for manipulating triggers. This struct is version compatible. You can expect a constant effect across different supported version.
Examples
use aoe2_probe::Scenario;
//Encode a scenario to a little endian vector of uint8
let mut source_scenario = Scenario::from_file("./resources/chapter_1.aoe2scenario");
let triggers_proxy = source_scenario.triggers_proxy();
Auto Trait Implementations
impl RefUnwindSafe for Scenario
impl Send for Scenario
impl Sync for Scenario
impl Unpin for Scenario
impl UnwindSafe for Scenario
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more