diff --git a/hwe/compare/turn_command_trace.php b/hwe/compare/turn_command_trace.php index 0cc9eb39..59924632 100644 --- a/hwe/compare/turn_command_trace.php +++ b/hwe/compare/turn_command_trace.php @@ -158,11 +158,10 @@ function comparisonApplyTurnFixtureSetup(mixed $setup): void $setup['randomFoundingCandidateCityIds'], 'randomFoundingCandidateCityIds', ); - if ($candidateCityIds === []) { - throw new \InvalidArgumentException('randomFoundingCandidateCityIds must not be empty'); - } $db->update('city', ['level' => 4], '1 = 1'); - $db->update('city', ['level' => 5], 'city IN %li', $candidateCityIds); + if ($candidateCityIds !== []) { + $db->update('city', ['level' => 5], 'city IN %li', $candidateCityIds); + } } if (($setup['isolateWorld'] ?? false) === true) { @@ -190,6 +189,8 @@ function comparisonApplyTurnFixtureSetup(mixed $setup): void 'front' => 0, 'state' => 0, 'term' => 0, + 'conflict' => '{}', + 'officer_set' => 0, ], '1 = 1'); } @@ -300,7 +301,14 @@ function comparisonApplyTurnFixtureSetup(mixed $setup): void 'term' => 'term', 'trust' => 'trust', 'trade' => 'trade', + 'officerSet' => 'officer_set', ]); + if (array_key_exists('conflict', $row)) { + if (!is_array($row['conflict'])) { + throw new \InvalidArgumentException('setup.cities.conflict must be an object'); + } + $patch['conflict'] = Json::encode($row['conflict']); + } if ($patch !== []) { $db->update('city', $patch, 'city = %i', $row['id']); } diff --git a/hwe/compare/turn_state_snapshot.php b/hwe/compare/turn_state_snapshot.php index 5f758eb9..128929c3 100644 --- a/hwe/compare/turn_state_snapshot.php +++ b/hwe/compare/turn_state_snapshot.php @@ -271,7 +271,10 @@ function comparisonTurnStateSnapshot(array $request): array 'term' => 'term', 'trust' => 'trust', 'trade' => 'trade', + 'conflict' => 'conflict', + 'officerSet' => 'officer_set', ], + ['conflict'], ), comparisonRowsById('city', 'city', $cityIds), );