comments
This commit is contained in:
@@ -745,6 +745,7 @@ pub fn serialize<W:BinWriterExt>(block:&Block,writer:&mut W)->Result<(),binrw::E
|
||||
];
|
||||
#[derive(Clone,Default)]
|
||||
struct Plan<T>([T;8]);
|
||||
// A plan of how many events of each type to include in a data block.
|
||||
impl Plan<usize>{
|
||||
fn accumulate(&mut self,event_type:EventType){
|
||||
self.0[event_type as usize]+=1;
|
||||
@@ -753,6 +754,7 @@ pub fn serialize<W:BinWriterExt>(block:&Block,writer:&mut W)->Result<(),binrw::E
|
||||
Plan(core::array::from_fn(|i|self.0[i]..end.0[i]))
|
||||
}
|
||||
}
|
||||
// A plan of what range of events to include in a data block.
|
||||
impl Plan<Range<usize>>{
|
||||
fn size(&self)->usize{
|
||||
self.0
|
||||
@@ -891,13 +893,18 @@ pub fn serialize<W:BinWriterExt>(block:&Block,writer:&mut W)->Result<(),binrw::E
|
||||
|
||||
plan_order.push(planned.plan);
|
||||
};
|
||||
// push three important blocks
|
||||
// the first block in the file is an offline block to
|
||||
// initialize the state of things like the current style
|
||||
if let Some(plan)=plan_offline.pop_front(){
|
||||
push_block(&mut offline_blocks_timeline,plan);
|
||||
}
|
||||
// the second block is the first realtime block which
|
||||
// includes the starting position of the replay
|
||||
if let Some(plan)=plan_realtime.pop_front(){
|
||||
push_block(&mut realtime_blocks_timeline,plan);
|
||||
}
|
||||
// the third block is the last realtime block which
|
||||
// is used by the game client to determine the duration
|
||||
if let Some(plan)=plan_realtime.pop_back(){
|
||||
push_block(&mut realtime_blocks_timeline,plan);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user