From 408d0e4862f778ae3d123df64fd9877567386568 Mon Sep 17 00:00:00 2001 From: FloPinguin <25036848+FloPinguin@users.noreply.github.com> Date: Mon, 27 Apr 2026 03:10:27 +0200 Subject: [PATCH] =?UTF-8?q?Improve=20TribeExecution=20deleteAllStructures?= =?UTF-8?q?=20=F0=9F=8F=9B=EF=B8=8F=20(#3777)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Description: `deleteAllStructures` did not check for `isMarkedForDeletion`, not very clean. Now its clean. Also rename to `deleteNextStructure` because its not possible to delete more than 1 structure at a time. ## Please complete the following: - [X] I have added screenshots for all UI updates - [X] I process any text displayed to the user through translateText() and I've added it to the en.json file - [X] I have added relevant tests to the test directory - [X] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced ## Please put your Discord username so you can be contacted if a bug or regression is found: FloPinguin --- src/core/execution/TribeExecution.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/core/execution/TribeExecution.ts b/src/core/execution/TribeExecution.ts index 16ee48aef..b288d67ad 100644 --- a/src/core/execution/TribeExecution.ts +++ b/src/core/execution/TribeExecution.ts @@ -60,7 +60,7 @@ export class TribeExecution implements Execution { } this.acceptAllAllianceRequests(); - this.deleteAllStructures(); + this.deleteNextStructure(); this.maybeAttack(); } @@ -83,11 +83,13 @@ export class TribeExecution implements Execution { } } - private deleteAllStructures() { + private deleteNextStructure() { + if (!this.tribe.canDeleteUnit()) return; for (const unit of this.tribe.units()) { - if (Structures.has(unit.type()) && this.tribe.canDeleteUnit()) { - this.mg.addExecution(new DeleteUnitExecution(this.tribe, unit.id())); - } + if (!Structures.has(unit.type())) continue; + if (unit.isMarkedForDeletion()) continue; + this.mg.addExecution(new DeleteUnitExecution(this.tribe, unit.id())); + return; } }