relese global intention
This commit is contained in:
1 parent
60bd764bcf
commit
a02b40c043
2 files changed
+24
-10
No files matched your search
+19
-5
@@ -86,18 +86,32 @@ impl World {
|
||||
}
|
||||
}
|
||||
}
|
||||
let mut global_it: Vec<LinkIntention<Intention>> = Vec::new();
|
||||
for i in 0..self.agents.len() {
|
||||
if let Some(ag) = self.agents.get(i) {
|
||||
global_it.push(LinkIntention {
|
||||
it: Intention::MoveTo(ag.wolk_a()),
|
||||
let pos = ag.get_pos();
|
||||
let mut p = plane_of_intentions.get_mut_wrap(pos);
|
||||
p.push(LinkIntention {
|
||||
it: Intention::StakedOut,
|
||||
lin: i,
|
||||
});
|
||||
global_it.push(LinkIntention {
|
||||
it: Intention::StakedOut(ag.get_pos()),
|
||||
let mv = ag.wolk_a();
|
||||
p = plane_of_intentions.get_mut_wrap(mv);
|
||||
p.push(LinkIntention {
|
||||
it: Intention::MoveTo,
|
||||
lin: i,
|
||||
});
|
||||
}
|
||||
}
|
||||
for i in 0..self.size.0 {
|
||||
for j in 0..self.size.1 {
|
||||
let cell = plane_of_intentions.get_mut_wrap((i as i32, j as i32));
|
||||
if cell.len() == 1 {
|
||||
if cell[0].it == Intention::MoveTo {
|
||||
let ag = self.agents.get_mut(cell[0].lin).unwrap();
|
||||
ag.move_to(ag.wolk_a());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user