diff --git a/hwe/compare/turn_command_trace.php b/hwe/compare/turn_command_trace.php index ace4679a..c5b03fa4 100644 --- a/hwe/compare/turn_command_trace.php +++ b/hwe/compare/turn_command_trace.php @@ -158,6 +158,7 @@ function comparisonApplyTurnFixtureSetup(mixed $setup): void throw new \InvalidArgumentException('isolateWorld requires generals and nations'); } $db->delete('general_turn', 'general_id NOT IN %li', $generalIds); + $db->delete('rank_data', 'general_id NOT IN %li', $generalIds); $db->delete('nation_turn', 'nation_id NOT IN %li', $nationIds); $db->delete('troop', '1 = 1'); $db->delete('diplomacy', '1 = 1'); @@ -325,6 +326,13 @@ function comparisonApplyTurnFixtureSetup(mixed $setup): void $db->update('general', $patch, 'no = %i', $row['id']); } } + if (($setup['isolateWorld'] ?? false) === true && ($setup['generals'] ?? []) !== []) { + $maxGeneralId = max(array_map( + static fn(array $row): int => (int)$row['id'], + $setup['generals'], + )); + $db->query('ALTER TABLE general AUTO_INCREMENT = %i', $maxGeneralId + 1); + } foreach ($setup['troops'] ?? [] as $row) { if (