From 85d92f1a2ca6f85bad3f8497a463ddc31ce5bb27 Mon Sep 17 00:00:00 2001 From: Nicholas McDaniel Date: Tue, 28 Oct 2025 23:06:21 -0400 Subject: [PATCH] Properly check disabled state of training squad The value of the training_squad state was being ignored, despite being used by the ui to distinguish between being enabled, or being disabled. This caused later disabled squads to remain in the pool of training squads. --- autotraining.lua | 4 ++-- changelog.txt | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/autotraining.lua b/autotraining.lua index 5c7df3578..386ab6bb0 100644 --- a/autotraining.lua +++ b/autotraining.lua @@ -139,9 +139,9 @@ end function getTrainingSquads() local squads = {} - for squad_id, _ in pairs(state.training_squads) do + for squad_id, active in pairs(state.training_squads) do local squad = df.squad.find(squad_id) - if squad then + if active and squad then table.insert(squads, squad) else -- setting to nil during iteration is permitted by lua diff --git a/changelog.txt b/changelog.txt index 9393bba89..dbcb8cd07 100644 --- a/changelog.txt +++ b/changelog.txt @@ -33,6 +33,7 @@ Template for new versions: ## New Features ## Fixes +- `autotraining`: squads once used for training then disabled now properly are treated as disabled. ## Misc Improvements