From 811ef651263547b13cc974d56d5e785bde2b2328 Mon Sep 17 00:00:00 2001 From: Fabio Pedretti Date: Sun, 16 Aug 2026 12:22:28 +0200 Subject: [PATCH] Fix: Correct control group iteration in ResolveFoundationCollisions In `CCmpObstruction::ResolveFoundationCollisions`, the nested loop intended to assign a persistent control group to colliding normal entities was incorrectly iterating over `normalEnts` instead of `persistentEnts`. This caused the function to attempt to clobber default control groups with other non-persistent groups, completely bypassing the intended `ControlPersist` logic. This patch fixes the inner loop to correctly iterate over `persistentEnts`, ensuring foundations properly inherit persistent control groups. Fixes: 9ae084519f --- source/simulation2/components/CCmpObstruction.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source/simulation2/components/CCmpObstruction.cpp b/source/simulation2/components/CCmpObstruction.cpp index 20d52b314a..ee9b532679 100644 --- a/source/simulation2/components/CCmpObstruction.cpp +++ b/source/simulation2/components/CCmpObstruction.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2025 Wildfire Games. +/* Copyright (C) 2026 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -819,7 +819,7 @@ public: for (const entity_id_t normalEnt : normalEnts) { CmpPtr cmpObstruction(GetSimContext(), normalEnt); - for (const entity_id_t persistent : normalEnts) + for (const entity_id_t persistent : persistentEnts) { entity_id_t group = cmpObstruction->GetControlGroup();