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
This commit is contained in:
Fabio Pedretti
2026-08-16 12:22:28 +02:00
parent 6ffc251114
commit 811ef65126
@@ -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<ICmpObstruction> cmpObstruction(GetSimContext(), normalEnt);
for (const entity_id_t persistent : normalEnts)
for (const entity_id_t persistent : persistentEnts)
{
entity_id_t group = cmpObstruction->GetControlGroup();