diff --git a/f_install/j_setup_db.php b/f_install/j_setup_db.php index 7e47fc8a..a4550e9d 100644 --- a/f_install/j_setup_db.php +++ b/f_install/j_setup_db.php @@ -124,7 +124,14 @@ $rootDB->error_handler = 'dbSQLFail'; $mysqli_obj = $rootDB->get(); //로그인에 실패할 경우 자동으로 dbConnFail()이 실행됨. if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/common_schema.sql'))){ - while (@$mysqli_obj->next_result()) {;} + while(true){ + if (!$mysqli_obj->more_results()) { + break; + } + if(!$mysqli_obj->next_result()){ + break; + } + } } $rootDB->insert('system', array( diff --git a/twe/func_gamerule.php b/twe/func_gamerule.php index 85880114..e9e230c7 100644 --- a/twe/func_gamerule.php +++ b/twe/func_gamerule.php @@ -207,26 +207,20 @@ function SetNationFront($nationNo) { $adj = []; $db = DB::db(); - $warNations = $db->queryFirstColumn( - 'SELECT you from diplomacy where me = %i and (state=0 or (state=1 and term<=3))' + $enemyCities = $db->queryFirstColumn( + 'SELECT city from city where nation IN + (SELECT you from diplomacy where me = %i and (state=0 or (state=1 and term<=3)))' , $nationNo ); - if($warNations) { - foreach($warNations as $warNation){ - $enemyCities = $db->queryFirstColumn('SELECT city from city where nation=%i', $warNation); - foreach($enemyCities as $city){ - foreach(CityConst::byID($city)->path as $adjCity){ - $adj[$adjCity] = 1; - } - } + if($enemyCities) { + foreach($enemyCities as $city){ + $adj = array_merge($adj, CityConst::byID($city)->path); } } else { //평시이면 공백지 //NOTE: if, else일 경우 NPC는 전쟁시에는 공백지로 출병하지 않는다는 뜻이 된다. foreach ($db->queryFirstColumn('SELECT city,path from city where nation=0') as $city) { - foreach(CityConst::byID($city)->path as $adjCity){ - $adj[$adjCity] = 1; - } + $adj = array_merge($adj, CityConst::byID($city)->path); } } diff --git a/twe/j_install.php b/twe/j_install.php index 3e4bc3eb..4056ad36 100644 --- a/twe/j_install.php +++ b/twe/j_install.php @@ -63,11 +63,26 @@ $scenarioObj = new Scenario($scenario); $startyear = $scenarioObj->getYear(); if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/reset.sql'))){ - while (@$mysqli_obj->next_result()) {;} + while(true){ + if (!$mysqli_obj->more_results()) { + break; + } + if(!$mysqli_obj->next_result()){ + break; + } + } + } if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/schema.sql'))){ - while (@$mysqli_obj->next_result()) {;} + while(true){ + if (!$mysqli_obj->more_results()) { + break; + } + if(!$mysqli_obj->next_result()){ + break; + } + } } diff --git a/twe/j_install_db.php b/twe/j_install_db.php index ec78e1cf..bfeda051 100644 --- a/twe/j_install_db.php +++ b/twe/j_install_db.php @@ -30,7 +30,14 @@ if($fullReset && class_exists('\\sammo\\DB')){ $mysqli_obj = DB::db()->get(); if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/reset.sql'))){ - while (@$mysqli_obj->next_result()) {;} + while(true){ + if (!$mysqli_obj->more_results()) { + break; + } + if(!$mysqli_obj->next_result()){ + break; + } + } } }