tile content iterator with runstate tweak - returns optional runstate
This commit is contained in:
parent
012d61603a
commit
76cc6a6938
4 changed files with 12 additions and 12 deletions
|
|
@ -103,17 +103,17 @@ where
|
|||
|
||||
/// Calls a function on every entity within a given tile idx, with the
|
||||
/// added ability to return a RunState mid-calc.
|
||||
pub fn for_each_tile_content_with_runstate<F>(idx: usize, mut f: F) -> RunState
|
||||
pub fn for_each_tile_content_with_runstate<F>(idx: usize, mut f: F) -> Option<RunState>
|
||||
where
|
||||
F: FnMut(Entity) -> Option<RunState>,
|
||||
{
|
||||
let lock = SPATIAL_MAP.lock().unwrap();
|
||||
for entity in lock.tile_content[idx].iter() {
|
||||
if let Some(rs) = f(entity.0) {
|
||||
return rs;
|
||||
return Some(rs);
|
||||
}
|
||||
}
|
||||
return RunState::AwaitingInput;
|
||||
return None;
|
||||
}
|
||||
|
||||
/// Calls a function on every entity within a given tile idx, breaking if
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue