aboutsummaryrefslogtreecommitdiff
path: root/crates/fparkan-runtime/src/mission_events.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2026-11-14 09:02:23 +0300
committerValentin Popov <valentin@popov.link>2026-11-14 09:02:23 +0300
commitd4c2ee22771b20208ee07ec38d868c3b0ce963bf (patch)
tree2ccf2da527dd9e664d3f2ab541e852ded8474e2d /crates/fparkan-runtime/src/mission_events.rs
parent176b377c8d4406161ff206a8cb5ac8c8359877cf (diff)
downloadfparkan-d4c2ee22771b20208ee07ec38d868c3b0ce963bf.tar.xz
fparkan-d4c2ee22771b20208ee07ec38d868c3b0ce963bf.zip
feat(runtime): replenish AutoDemo clans after combat losses
Diffstat (limited to 'crates/fparkan-runtime/src/mission_events.rs')
-rw-r--r--crates/fparkan-runtime/src/mission_events.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/crates/fparkan-runtime/src/mission_events.rs b/crates/fparkan-runtime/src/mission_events.rs
index a9b3cf9d..098cf47d 100644
--- a/crates/fparkan-runtime/src/mission_events.rs
+++ b/crates/fparkan-runtime/src/mission_events.rs
@@ -140,6 +140,12 @@ pub(super) struct MissionEvents {
}
impl MissionEvents {
+ pub(super) fn register_unit(&mut self, world: &World, handle: ObjectHandle, class: u32) {
+ self.placed_clan_objects
+ .retain(|(handle, _)| registration_sequence(world, *handle).is_ok());
+ self.placed_clan_objects.push((handle, class));
+ }
+
pub(super) fn with_placed_objects(
world: &mut World,
drafts: &[MissionObjectDraft],
@@ -382,7 +388,7 @@ fn count_clan_objects(
owner: OwnerId,
mask: u32,
) -> u32 {
- // shortcut: count placed units until production registers new objects here.
+ // All registered handles, including replacements, are checked against live ownership.
objects
.iter()
.filter(|&&(handle, class)| {