test: capture legacy battle parity fixtures

This commit is contained in:
2026-08-05 03:08:04 +00:00
parent 605fd3c9d1
commit 5e279eb666
3 changed files with 196 additions and 3 deletions
+19
View File
@@ -40,6 +40,25 @@ function processWar(string $warSeed, General $attackerGeneral, array $rawAttacke
$defenderCityGeneralIDList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND city=%i AND nation!=0', $city->getVar('nation'), $city->getVar('city'));
$defenderCityGeneralList = General::createObjListFromDB($defenderCityGeneralIDList, null);
$captureBattleFixture =
PHP_SAPI === 'cli'
&& getenv('REF_DETERMINISTIC_INSTALL_ENABLED') === '1'
&& getenv('REF_BATTLE_FIXTURE_TRACE') === '1';
if ($captureBattleFixture) {
require_once __DIR__ . '/compare/battle_fixture_capture.php';
fwrite(STDOUT, 'AI_WAR_FIXTURE_REF ' . Json::encode(comparisonBuildBattleFixture(
$warSeed,
(int)$year,
(int)$month,
(int)$startYear,
$attackerGeneral,
$rawAttackerNation,
$defenderCityGeneralList,
$rawDefenderCity,
$rawDefenderNation,
)) . "\n");
}
/** @var WarUnit[] */
$defenderList = [];
$defenderCandidateTrace = [];