26 行
1.4 KiB
PHP
26 行
1.4 KiB
PHP
<?php
|
|
require __DIR__ . '/../application/common/library/GranaryScreen.php';
|
|
use app\common\library\GranaryScreen;
|
|
|
|
function check($condition, $message) {
|
|
if (!$condition) throw new RuntimeException($message);
|
|
}
|
|
$positions = GranaryScreen::extraPositions();
|
|
check(count($positions) === 11, 'All eleven configurable building positions must exist');
|
|
$lastX = 0;
|
|
for ($i = 1; $i <= 7; $i++) {
|
|
$position = 'center_silo_' . $i;
|
|
$item = ['id' => 200 + $i, 'num' => 46 + $i, 'content' => ['screenPosition' => $position]];
|
|
$coord = GranaryScreen::resolve($item, []);
|
|
check($coord['x'] > $lastX, 'Silos must run from left to right');
|
|
check($coord['stemY'] > $coord['y'] && $coord['stemY'] < 32, 'Lead line must point to the silo roof');
|
|
$item['num'] = 900 + $i;
|
|
check(GranaryScreen::resolve($item, []) === $coord, 'Renumbering must preserve the building');
|
|
$lastX = $coord['x'];
|
|
}
|
|
$middle = GranaryScreen::resolve(['id' => 46, 'num' => 43, 'content' => ['screenPosition' => 'center_middle']], []);
|
|
$rear = GranaryScreen::resolve(['id' => 114, 'num' => 46, 'content' => ['screenPosition' => 'center_rear']], []);
|
|
check($middle !== $rear, '43 and 46 must label two separate buildings');
|
|
check(GranaryScreen::resolve(['id' => 43, 'num' => 14, 'content' => []], [14 => ['x' => 4.8, 'y' => 12.8]]) === ['x' => 4.8, 'y' => 12.8], 'Oil tank numbering must remain separate');
|
|
echo "All building position checks passed\n";
|