refactor add_agent
This commit is contained in:
1 parent
f9842f635b
commit
25af75b381
1 file changed
+3
-2
+3
-2
@@ -34,8 +34,9 @@ impl World {
|
|||||||
if p.is_some() {
|
if p.is_some() {
|
||||||
return Err("ERROR: pos занято");
|
return Err("ERROR: pos занято");
|
||||||
}
|
}
|
||||||
self.agents.push(Arc::new(Mutex::new(ag)));
|
let rec_ag = Arc::new(Mutex::new(ag));
|
||||||
*p = Some(Arc::clone(&self.agents[self.agents.len() -1]));
|
self.agents.push(Arc::clone(&rec_ag));
|
||||||
|
*p = Some(Arc::clone(&rec_ag));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
pub fn get_grid(&self) -> &TorusGrid<bool>{
|
pub fn get_grid(&self) -> &TorusGrid<bool>{
|
||||||
|
|||||||
Reference in new issue
Block a user