diff --git a/hwe/compare/turn_command_trace.php b/hwe/compare/turn_command_trace.php index 793a3edf..2b82f5a3 100644 --- a/hwe/compare/turn_command_trace.php +++ b/hwe/compare/turn_command_trace.php @@ -128,6 +128,23 @@ function comparisonApplyTurnFixtureSetup(mixed $setup): void } UniqueConst::$hiddenSeed = $hiddenSeed; } + if (array_key_exists('staticEventHandlers', $world)) { + $handlersByEvent = $world['staticEventHandlers']; + if (!is_array($handlersByEvent)) { + throw new \InvalidArgumentException('setup.world.staticEventHandlers must be an object'); + } + foreach ($handlersByEvent as $eventType => $handlers) { + if (!is_string($eventType) || $eventType === '' || !is_array($handlers)) { + throw new \InvalidArgumentException('setup.world.staticEventHandlers is invalid'); + } + foreach ($handlers as $handler) { + if (!is_string($handler) || $handler === '') { + throw new \InvalidArgumentException('setup.world.staticEventHandlers is invalid'); + } + } + } + GameConst::$staticEventHandlers = $handlersByEvent; + } } foreach (['nations', 'cities', 'generals', 'troops', 'diplomacy'] as $collection) {