diff --git a/hwe/func_history.php b/hwe/func_history.php index 258c9922..b5332fa5 100644 --- a/hwe/func_history.php +++ b/hwe/func_history.php @@ -16,7 +16,7 @@ function pushRawFileLog($path, $lines){ $lines = [$lines]; } $text = join("\n", $lines)."\n"; - file_put_contents($path, $text, FILE_APPEND); + file_put_contents($path, $text, FILE_APPEND | LOCK_EX); } function getRawFileLogRecent(string $path, int $count, $expectedLineLength=null){ diff --git a/hwe/sammo/GeneralAI.php b/hwe/sammo/GeneralAI.php index 7d836aaa..8d2ab823 100644 --- a/hwe/sammo/GeneralAI.php +++ b/hwe/sammo/GeneralAI.php @@ -1577,7 +1577,7 @@ class GeneralAI{ return ['che_건국', [ 'nationName'=>"㉿".mb_substr($general->getName(), 1), 'nationType'=>$nationType, - 'nationColor'=>$nationColor + 'colorType'=>$nationColor ]]; } diff --git a/src/sammo/StringUtil.php b/src/sammo/StringUtil.php index a6fec0b0..ff1cf284 100644 --- a/src/sammo/StringUtil.php +++ b/src/sammo/StringUtil.php @@ -183,19 +183,20 @@ class StringUtil } public static function uniord(string $c) { - if (ord($c{0}) >=0 && ord($c{0}) <= 127) - return ord($c{0}); - if (ord($c{0}) >= 192 && ord($c{0}) <= 223) - return (ord($c{0})-192)*64 + (ord($c{1})-128); - if (ord($c{0}) >= 224 && ord($c{0}) <= 239) - return (ord($c{0})-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128); - if (ord($c{0}) >= 240 && ord($c{0}) <= 247) - return (ord($c{0})-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128); - if (ord($c{0}) >= 248 && ord($c{0}) <= 251) - return (ord($c{0})-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128); - if (ord($c{0}) >= 252 && ord($c{0}) <= 253) - return (ord($c{0})-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128); - if (ord($c{0}) >= 254 && ord($c{0}) <= 255) // error + $c0 = ord($c{0}); + if ($c0 >=0 && $c0 <= 127) + return $c0; + if ($c0 >= 192 && $c0 <= 223) + return ($c0-192)*64 + (ord($c{1})-128); + if ($c0 >= 224 && $c0 <= 239) + return ($c0-224)*4096 + (ord($c{1})-128)*64 + (ord($c{2})-128); + if ($c0 >= 240 && $c0 <= 247) + return ($c0-240)*262144 + (ord($c{1})-128)*4096 + (ord($c{2})-128)*64 + (ord($c{3})-128); + if ($c0 >= 248 && $c0 <= 251) + return ($c0-248)*16777216 + (ord($c{1})-128)*262144 + (ord($c{2})-128)*4096 + (ord($c{3})-128)*64 + (ord($c{4})-128); + if ($c0 >= 252 && $c0 <= 253) + return ($c0-252)*1073741824 + (ord($c{1})-128)*16777216 + (ord($c{2})-128)*262144 + (ord($c{3})-128)*4096 + (ord($c{4})-128)*64 + (ord($c{5})-128); + if ($c0 >= 254 && $c0 <= 255) // error return FALSE; return 0; } diff --git a/src/sammo/Util.php b/src/sammo/Util.php index b41cca86..b9d05d74 100644 --- a/src/sammo/Util.php +++ b/src/sammo/Util.php @@ -625,12 +625,9 @@ class Util extends \utilphp\util } //.이 들어간 경우에는 분리해서 묶어야함. return join(',', array_map(function($value){ - $value = trim($value, " \t\r\n\0\x0b`"); + $value = preg_replace('/\s/', '', $value); if(strpos($value, '.') !== false){ $value = explode('.', $value); - $value = array_map(function($str){ - return trim($value, " \t\r\n\0\x0b`"); - }, $value); $value = join('`.`', $value); } return "`{$value}`";