Various crash fixes.
This commit is contained in:
parent
488037d074
commit
e4ee87ee27
|
@ -1,6 +1,7 @@
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
|
||||||
use bevy::{
|
use bevy::{
|
||||||
|
ecs::entity::Entities,
|
||||||
prelude::*,
|
prelude::*,
|
||||||
tasks::{prelude::*, Task},
|
tasks::{prelude::*, Task},
|
||||||
};
|
};
|
||||||
|
@ -258,11 +259,17 @@ fn poll_tasks(mut commands: Commands, mut query: Query<(Entity, &mut Calculating
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn remove_destination(mut commands: Commands, removed: RemovedComponents<Destination>) {
|
fn remove_destination(
|
||||||
|
mut commands: Commands,
|
||||||
|
entities: &Entities,
|
||||||
|
removed: RemovedComponents<Destination>,
|
||||||
|
) {
|
||||||
for entity in removed.iter() {
|
for entity in removed.iter() {
|
||||||
|
if entities.contains(entity) {
|
||||||
commands.entity(entity).remove::<Calculating>();
|
commands.entity(entity).remove::<Calculating>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn negotiate_path(
|
fn negotiate_path(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
|
|
|
@ -314,7 +314,7 @@ fn remove_visible(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
visible_entities.remove(&removed);
|
visible_entities.remove(&removed);
|
||||||
let map = map.single();
|
if let Ok(map) = map.get_single() {
|
||||||
let mut cache = HashMap::new();
|
let mut cache = HashMap::new();
|
||||||
viewshed.update(
|
viewshed.update(
|
||||||
&viewer_entity,
|
&viewer_entity,
|
||||||
|
@ -330,6 +330,7 @@ fn remove_visible(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn update_revealed_tiles(
|
fn update_revealed_tiles(
|
||||||
mut map: Query<(&Map, &mut RevealedTiles)>,
|
mut map: Query<(&Map, &mut RevealedTiles)>,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user