tweak instruction collector
This commit is contained in:
parent
75c8bc2bbb
commit
77db5a7a6b
@ -62,6 +62,7 @@ impl<I,T> InstructionCollector<I,T>
|
||||
pub const fn time(&self)->Time<T>{
|
||||
self.time
|
||||
}
|
||||
#[inline]
|
||||
pub fn collect(&mut self,instruction:Option<TimedInstruction<I,T>>){
|
||||
if let Some(ins)=instruction{
|
||||
if ins.time<self.time{
|
||||
@ -70,7 +71,8 @@ impl<I,T> InstructionCollector<I,T>
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn instruction(self)->Option<TimedInstruction<I,T>>{
|
||||
#[inline]
|
||||
pub fn take(self)->Option<TimedInstruction<I,T>>{
|
||||
//STEAL INSTRUCTION AND DESTROY INSTRUCTIONCOLLECTOR
|
||||
self.instruction.map(|instruction|TimedInstruction{
|
||||
time:self.time,
|
||||
|
@ -1111,7 +1111,7 @@ impl PhysicsData{
|
||||
//this is the one who asks
|
||||
fn next_instruction_internal(state:&PhysicsState,data:&PhysicsData,time_limit:Time)->Option<TimedInstruction<InternalInstruction,TimeInner>>{
|
||||
//JUST POLLING!!! NO MUTATION
|
||||
let mut collector = instruction::InstructionCollector::new(time_limit);
|
||||
let mut collector=instruction::InstructionCollector::new(time_limit);
|
||||
|
||||
collector.collect(state.next_move_instruction());
|
||||
|
||||
@ -1145,7 +1145,7 @@ impl PhysicsData{
|
||||
)
|
||||
);
|
||||
});
|
||||
collector.instruction()
|
||||
collector.take()
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user