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 "