메시지 전송 시스템을 새 시스템에 맞게 수정

국가의 기본 정보를 중복 쿼리 없이 받아오는 함수 추가
  - 해당 함수를 위해 국가색, 건국 등의 국가 정보가 바뀌는 경우 refresh
새 메시지 시스템 적용을 위해 메인 페이지 틀 변경
This commit is contained in:
2018-02-22 02:04:54 +09:00
parent 2fb005ec6d
commit 34cd58d8f3
15 changed files with 180 additions and 226 deletions
+35 -16
View File
@@ -139,6 +139,40 @@ function getGeneralName($forceExit=false)
return $generalName;
}
/**
* nationID를 이용하여 국가의 '어지간해선' 변경되지 않는 정보(이름, 색, 성향, 수도)를 반환해줌
*
* @param int|null $nationID 국가 코드
* @param bool $forceRefresh 강제 갱신 여부
*
* @return array|null nationID에 해당하는 국가가 있을 경우 array 반환. 그외의 경우 null
*/
function getNationStaticInfo($nationID, $forceRefresh=false)
{
static $nationList = null;
if ($forceRefresh) {
$nationList = null;
}
if($nationID === null || $nationID == 0){
return null;
}
if($nationList === null){
$nationList = ArrayToDict(
getDB()->query("select nation, name, color, type, capital from nation"),
"nation");
}
if(isset($nationList[$nationID])){
return $nationList[$nationID];
}
return null;
}
function GetImageURL($imgsvr) {
global $image, $image1;
if($imgsvr == 0) {
@@ -293,7 +327,6 @@ function getTurn($connect, $general, $type, $font=1) {
$str[$i] = "{$city['name']}】(으)로 이동";
break;
case 22: //등용
//TODO:등용장 재디자인
$double = $command[1];
$query = "select name from general where no='$double'";
@@ -3724,6 +3757,7 @@ function deleteNation($connect, $general) {
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
pushHistory($connect, $history);
getNationStaticInfo(null, false);
}
function nextRuler($connect, $general) {
@@ -4040,21 +4074,6 @@ function getRandTurn2($term) {
return $turntime;
}
function ScoutMsg($connect, $genNum, $nationName, $who, $msgIndex) {
return;
//TODO: 등용장 재 디자인.
//xxx: 일단 껐음
// 상대에게 발송
$msgIndex++;
if($msgIndex >= 10) { $msgIndex = 0; }
$date = date('Y-m-d H:i:s');
//등용 서신시 장수번호/내 번호
$me = $genNum * 10000 + $who;
$query = "update general set msgindex='$msgIndex',msg{$msgIndex}='{$nationName}(으)로 망명 권유 서신',msg{$msgIndex}_who='$me',msg{$msgIndex}_when='$date',msg{$msgIndex}_type='11' where no='$who'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
function command_Single($connect, $turn, $command) {
$command = EncodeCommand(0, 0, 0, $command);