From 2cd7d525a44b68d1720425399d17377837bc83e7 Mon Sep 17 00:00:00 2001 From: hide_d Date: Sat, 24 Feb 2018 17:41:04 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8B=A8=EC=88=9C=20=EA=B5=AD=EA=B0=80=20?= =?UTF-8?q?=EC=A0=95=EB=B3=B4=EB=A5=BC=20=EB=B0=9B=EC=95=84=EC=98=AC=20?= =?UTF-8?q?=EB=95=8C=20query=ED=95=98=EC=A7=80=20=EC=95=8A=EA=B3=A0=20?= =?UTF-8?q?=EC=A0=80=EC=9E=A5=EB=90=9C=20=EA=B0=92=EC=9D=84=20=EC=93=B0?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- twe/_admin8.php | 6 +----- twe/a_bestGeneral.php | 7 +------ twe/a_genList.php | 7 +------ twe/a_npcList.php | 7 +------ twe/b_currentCity.php | 7 +------ twe/func.php | 15 +++++++++++---- twe/func_gamerule.php | 29 ++++++++++++----------------- twe/func_message.php | 6 ++---- twe/func_process.php | 36 +++++++++--------------------------- twe/func_time_event.php | 14 +++++--------- twe/process_war.php | 4 +--- twe/scenario_1.php | 6 +----- twe/scenario_10.php | 6 +----- twe/scenario_11.php | 6 +----- twe/scenario_12.php | 6 +----- twe/scenario_2.php | 6 +----- twe/scenario_3.php | 6 +----- twe/scenario_4.php | 6 +----- twe/scenario_5.php | 6 +----- twe/scenario_6.php | 6 +----- twe/scenario_7.php | 6 +----- twe/scenario_8.php | 6 +----- twe/scenario_9.php | 6 +----- 23 files changed, 57 insertions(+), 153 deletions(-) diff --git a/twe/_admin8.php b/twe/_admin8.php index 228e7cdc..5b8646cf 100644 --- a/twe/_admin8.php +++ b/twe/_admin8.php @@ -66,12 +66,8 @@ $sel[$type] = "selected"; 비 고 query("select nation, name, color, type, level, capital from nation"), - "nation"); + $nationAll = getDB()->query("select nation, name, color, type, level, capital from nation"); + $nationList = ArrayToDict($nationAll, "nation"); + $nationList[-1] = $nationAll; } if(isset($nationList[$nationID])){ @@ -178,6 +178,13 @@ function refreshNationStaticInfo(){ getNationStaticInfo(null, true); } +/** + * getNationStaticInfo(-1) 의 단축형 + */ +function getAllNationStaticInfo(){ + return getNationStaticInfo(-1); +} + function GetImageURL($imgsvr) { global $image, $image1; if($imgsvr == 0) { diff --git a/twe/func_gamerule.php b/twe/func_gamerule.php index be07b4df..3f65873d 100644 --- a/twe/func_gamerule.php +++ b/twe/func_gamerule.php @@ -666,12 +666,10 @@ group by A.nation $dipCount = MYDB_num_rows($result); for($i=0; $i < $dipCount; $i++) { $dip = MYDB_fetch_array($result); - $query = "select name from nation where nation='{$dip['me']}' or nation='{$dip['you']}'"; - $nationResult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $nation = MYDB_fetch_array($nationResult); - $name1 = $nation['name']; - $nation = MYDB_fetch_array($nationResult); - $name2 = $nation['name']; + $nation1 = getNationStaticInfo($dip['me']); + $name1 = $nation1['name']; + $nation2 = getNationStaticInfo($dip['you']); + $name2 = $nation2['name']; $history[count($history)] = "●{$admin['year']}년 {$admin['month']}월:【개전】$name1(와)과 $name2(이)가 전쟁을 시작합니다."; } //휴전국 로그 @@ -684,12 +682,10 @@ group by A.nation //양측 기간 모두 0이 되는 상황이면 휴전 if($dip['term1'] <= 1 && $dip['term2'] <= 1) { - $query = "select name from nation where nation='{$dip['me']}' or nation='{$dip['you']}'"; - $nationResult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $nation = MYDB_fetch_array($nationResult); - $name1 = $nation['name']; - $nation = MYDB_fetch_array($nationResult); - $name2 = $nation['name']; + $nation1 = getNationStaticInfo($dip['me']); + $name1 = $nation1['name']; + $nation2 = getNationStaticInfo($dip['you']); + $name2 = $nation2['name']; $history[count($history)] = "●{$admin['year']}년 {$admin['month']}월:【휴전】$name1(와)과 $name2(이)가 휴전합니다."; //기한 되면 휴전으로 $query = "update diplomacy set state='2',term='0' where (me='{$dip['me']}' and you='{$dip['you']}') or (me='{$dip['you']}' and you='{$dip['me']}')"; @@ -726,11 +722,10 @@ group by A.nation // 시스템 거래건 등록 registerAuction($connect); //전방설정 - $query = "select nation from nation where level>0"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $count = MYDB_num_rows($result); - for($i=0; $i < $count; $i++) { - $nation = MYDB_fetch_array($result); + foreach(getAllNationStaticInfo() as $nation){ + if($nation['level'] <= 0){ + continue; + } SetNationFront($connect, $nation['nation']); } } diff --git a/twe/func_message.php b/twe/func_message.php index 85117022..34908dc3 100644 --- a/twe/func_message.php +++ b/twe/func_message.php @@ -220,7 +220,7 @@ function getMailboxList(){ } $nations = []; - foreach ($db->query('select nation, name, color from nation') as $nation) { + foreach (getAllNationStaticInfo() as $nation) { $nations[$nation['nation']] = $nation; } $nations[0] = [ @@ -262,9 +262,7 @@ function genList($connect) { $you = MYDB_fetch_array($result); } - $query = "select nation,color,name from nation where nation='{$me['nation']}'"; - $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); - $nation = MYDB_fetch_array($result); + $nation = getNationStaticInfo($me['nation']); echo "