fix: 대규모 이민족 소환 중단을 방지한다
This commit is contained in:
@@ -100,6 +100,17 @@ class RaiseInvader extends \sammo\Event\Action
|
||||
}
|
||||
|
||||
public function run(array $env)
|
||||
{
|
||||
$previousIgnoreUserAbort = ignore_user_abort(true);
|
||||
try {
|
||||
return $this->runToCompletion($env);
|
||||
}
|
||||
finally {
|
||||
ignore_user_abort($previousIgnoreUserAbort !== 0);
|
||||
}
|
||||
}
|
||||
|
||||
private function runToCompletion(array $env)
|
||||
{
|
||||
$db = DB::db();
|
||||
|
||||
@@ -196,6 +207,7 @@ class RaiseInvader extends \sammo\Event\Action
|
||||
], true);
|
||||
|
||||
$invaderNationIDList = [];
|
||||
$env = GeneralBuilder::prepareEnvironment($env);
|
||||
refreshNationStaticInfo();
|
||||
foreach ($cities as $cityObj) {
|
||||
if ($cityObj->level != 4) {
|
||||
|
||||
@@ -539,11 +539,8 @@ class GeneralBuilder{
|
||||
return $this->death;
|
||||
}
|
||||
|
||||
public function build($env){
|
||||
//scenario에 life==1인 경우 수명 제한이 없어지는 모양.
|
||||
|
||||
|
||||
|
||||
public static function prepareEnvironment(array $env): array
|
||||
{
|
||||
if(!key_exists('stored_icons', $env)){
|
||||
try{
|
||||
$text = \file_get_contents(\sammo\ServConfig::getSharedIconPath('../hook/list.json?1'));
|
||||
@@ -556,6 +553,16 @@ class GeneralBuilder{
|
||||
$env['stored_icons'] = $storedIcons;
|
||||
}
|
||||
|
||||
return $env;
|
||||
}
|
||||
|
||||
public function build($env){
|
||||
//scenario에 life==1인 경우 수명 제한이 없어지는 모양.
|
||||
|
||||
|
||||
|
||||
$env = static::prepareEnvironment($env);
|
||||
|
||||
$isFictionMode = (Util::array_get($env['fiction'], 0)!=0);
|
||||
|
||||
$year = $env['year'];
|
||||
|
||||
@@ -18,6 +18,16 @@ require_once __DIR__ . '/../hwe/sammo/Scenario/GeneralBuilder.php';
|
||||
|
||||
final class ScenarioGeneralBuilderSpecialTest extends TestCase
|
||||
{
|
||||
public function testPreparedStoredIconsAreReusedWithoutChangingTheEnvironment(): void
|
||||
{
|
||||
$environment = [
|
||||
'stored_icons' => ['.' => ['default.jpg']],
|
||||
'icon_path' => '.',
|
||||
];
|
||||
|
||||
self::assertSame($environment, GeneralBuilder::prepareEnvironment($environment));
|
||||
}
|
||||
|
||||
public function testAsiaPossessionScenarioWarSpecialsUseWarSlot(): void
|
||||
{
|
||||
$scenario = json_decode(
|
||||
|
||||
Reference in New Issue
Block a user