forked from StrafesNET/strafe-project
physics versioning plan
This commit is contained in:
@@ -28,12 +28,16 @@ pub enum Error{
|
||||
/* block types
|
||||
|
||||
BLOCK_BOT_HEADER:
|
||||
// Tegments are laid out in chronological order,
|
||||
// Segments are laid out in chronological order,
|
||||
// but block_id is not necessarily in ascending order.
|
||||
//
|
||||
// This is to place the final segment close to the start of the file,
|
||||
// which allows the duration of the bot to be conveniently calculated
|
||||
// from the first and last instruction timestamps.
|
||||
//
|
||||
// Use exact physics version for replay playback
|
||||
// Use highest compatible physics version for verification
|
||||
u32 physics_version
|
||||
u32 num_segments
|
||||
for _ in 0..num_segments{
|
||||
i64 time
|
||||
@@ -61,6 +65,7 @@ struct SegmentHeader{
|
||||
#[binrw]
|
||||
#[brw(little)]
|
||||
struct Header{
|
||||
physics_version:u32,
|
||||
num_segments:u32,
|
||||
#[br(count=num_segments)]
|
||||
segments:Vec<SegmentHeader>,
|
||||
@@ -151,7 +156,7 @@ impl<R:BinReaderExt> StreamableBot<R>{
|
||||
}
|
||||
|
||||
const MAX_BLOCK_SIZE:usize=64*1024;//64 kB
|
||||
pub fn write_bot<W:BinWriterExt>(mut writer:W,instructions:impl IntoIterator<Item=TimedPhysicsInstruction>)->Result<(),Error>{
|
||||
pub fn write_bot<W:BinWriterExt>(mut writer:W,physics_version:u32,instructions:impl IntoIterator<Item=TimedPhysicsInstruction>)->Result<(),Error>{
|
||||
// decide which instructions to put in which segment
|
||||
// write segment 1 to block 1
|
||||
// write segment N to block 2
|
||||
@@ -251,6 +256,7 @@ pub fn write_bot<W:BinWriterExt>(mut writer:W,instructions:impl IntoIterator<Ite
|
||||
};
|
||||
|
||||
let header=Header{
|
||||
physics_version,
|
||||
num_segments:num_segments as u32,
|
||||
segments,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user