diff options
Diffstat (limited to 'crates/fparkan-runtime/src/unit_patrol.rs')
| -rw-r--r-- | crates/fparkan-runtime/src/unit_patrol.rs | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/crates/fparkan-runtime/src/unit_patrol.rs b/crates/fparkan-runtime/src/unit_patrol.rs index 44e83986..4f708af3 100644 --- a/crates/fparkan-runtime/src/unit_patrol.rs +++ b/crates/fparkan-runtime/src/unit_patrol.rs @@ -32,6 +32,7 @@ pub(super) struct UnitPatrol { animal_migration: Vec<AnimalMigration>, migration_rng: u32, shut_down: HashSet<ObjectHandle>, + standing: HashSet<ObjectHandle>, script_orders: Vec<(ObjectHandle, VecDeque<orders::UnitOrder>)>, script_order_counts: BTreeMap<(u32, u32), u64>, clock_ms: u32, @@ -168,6 +169,7 @@ impl UnitPatrol { animal_migration: Vec::new(), migration_rng: 1, shut_down: HashSet::new(), + standing: HashSet::new(), script_orders: Vec::new(), script_order_counts: BTreeMap::new(), clock_ms: 0, @@ -189,6 +191,7 @@ impl UnitPatrol { ) -> bool { self.script_orders.retain(|(unit, _)| *unit != handle); self.shut_down.remove(&handle); + self.standing.remove(&handle); self.units .retain(|unit| transform_state(world, unit.handle).is_ok()); if let Some(unit) = self.units.iter_mut().find(|unit| unit.handle == handle) { @@ -365,6 +368,7 @@ impl UnitPatrol { pub(super) fn shut_down(&mut self, handle: ObjectHandle) -> bool { self.script_orders.retain(|(unit, _)| *unit != handle); + self.standing.remove(&handle); // shortcut: stop autonomous movement and fire until the native shutdown task is modeled. self.units.retain(|unit| unit.handle != handle); self.shut_down.insert(handle) @@ -498,6 +502,7 @@ impl UnitPatrol { animal_migration: Vec::new(), migration_rng: 1, shut_down: HashSet::new(), + standing: HashSet::new(), script_orders: Vec::new(), script_order_counts: BTreeMap::new(), clock_ms: 0, |
